diff options
Diffstat (limited to 'server/src/routes/ui/style')
-rw-r--r-- | server/src/routes/ui/style/cantarell.woff2 | bin | 0 -> 93888 bytes | |||
-rw-r--r-- | server/src/routes/ui/style/layout.css | 45 | ||||
-rw-r--r-- | server/src/routes/ui/style/mod.rs | 51 |
3 files changed, 96 insertions, 0 deletions
diff --git a/server/src/routes/ui/style/cantarell.woff2 b/server/src/routes/ui/style/cantarell.woff2 Binary files differnew file mode 100644 index 0000000..76fd894 --- /dev/null +++ b/server/src/routes/ui/style/cantarell.woff2 diff --git a/server/src/routes/ui/style/layout.css b/server/src/routes/ui/style/layout.css new file mode 100644 index 0000000..0612a7e --- /dev/null +++ b/server/src/routes/ui/style/layout.css @@ -0,0 +1,45 @@ +@font-face { + font-family: 'Cantarell'; + src: url(/assets/cantarell.woff2) format('woff2'); +} + +* { + color: white; + font-family: "Cantarell", sans-serif; + font-weight: 300; + margin: 0px; + padding: 0px; +} + +body { + background-color: #1a1a1a; + width: 100vw; +} + +nav { + position: absolute; + top: 0px; + left: 0px; + padding: 1em; + width: calc(100vw - 2em); + height: 2em; + background-color: #41414144; +} + +nav h1 { + margin: 0px; + font-size: 1.5em; +} + +#main { + margin-top: 5em; + padding: 1em; + padding-left: 3em; + padding-right: 3em; +} + +.error { + padding: 1em; + color: rgb(255, 117, 117); + font-family: monospace; +}
\ No newline at end of file diff --git a/server/src/routes/ui/style/mod.rs b/server/src/routes/ui/style/mod.rs new file mode 100644 index 0000000..f3d751b --- /dev/null +++ b/server/src/routes/ui/style/mod.rs @@ -0,0 +1,51 @@ +use rocket::{get, http::ContentType}; +use std::{ + fs::{read_to_string, File}, + io::Read, + path::PathBuf, + str::FromStr, +}; + +fn css_bundle() -> String { + if cfg!(debug_assertions) { + read_to_string( + PathBuf::from_str(file!()) + .unwrap() + .parent() + .unwrap() + .join("layout.css"), + ) + .unwrap() + } else { + include_str!("layout.css").to_string() + } +} +fn font_bundle() -> Vec<u8> { + if cfg!(debug_assertions) { + let mut woff = Vec::new(); + + File::open( + PathBuf::from_str(file!()) + .unwrap() + .parent() + .unwrap() + .join("cantarell.woff2"), + ) + .unwrap() + .read_to_end(&mut woff) + .unwrap(); + woff + } else { + include_bytes!("cantarell.woff2").to_vec() + } +} + +#[get("/assets/style.css")] +pub fn r_assets_style() -> (ContentType, String) { + (ContentType::CSS, css_bundle()) +} + +#[get("/assets/cantarell.woff2")] +pub fn r_assets_font() -> (ContentType, Vec<u8>) { + (ContentType::WOFF2, font_bundle()) +} |