diff --git a/.gitignore b/.gitignore index e10f094..9b76d58 100644 --- a/.gitignore +++ b/.gitignore @@ -6,6 +6,7 @@ !src/errors/not_found/ !src/page/ !src/page/cube/ +!src/page/text/ !src/routes/ !src/routes/index/ diff --git a/src/page/BaiJamjuree700.woff2 b/src/page/BaiJamjureeBold.woff2 similarity index 100% rename from src/page/BaiJamjuree700.woff2 rename to src/page/BaiJamjureeBold.woff2 diff --git a/src/page/BaiJamjureeMedium.woff2 b/src/page/BaiJamjureeMedium.woff2 new file mode 100644 index 0000000..dfc55e1 Binary files /dev/null and b/src/page/BaiJamjureeMedium.woff2 differ diff --git a/src/page/cube/cube.css b/src/page/cube/cube.css index 6bc620b..0629d17 100644 --- a/src/page/cube/cube.css +++ b/src/page/cube/cube.css @@ -1,9 +1,3 @@ -@font-face { - font-family: "Bai Jamjuree"; - font-weight: 700; - src: url("/assets/BaiJamjuree700.woff2") format("woff2"); -} - body, html { height: 100%; @@ -11,10 +5,7 @@ html { } html { - background-color: #000000; - font-family: "Bai Jamjuree", sans; font-size: 450%; - overscroll-behavior: none; } @@ -31,7 +22,9 @@ html { } a { + /* Black on a white background */ color: #000000; + font-weight: bold; text-decoration-line: none; } @@ -105,4 +98,4 @@ a { .left { transform: rotateY(-89.99999999999999deg) translateZ(2.498em); -} \ No newline at end of file +} diff --git a/src/page/mod.rs b/src/page/mod.rs index 661d01e..8406977 100644 --- a/src/page/mod.rs +++ b/src/page/mod.rs @@ -1,5 +1,6 @@ pub mod cube; mod elements; +pub mod text; use std::sync::LazyLock; @@ -14,12 +15,21 @@ use maud::{ use crate::asset; -static MANIFEST: LazyLock = LazyLock::new(|| { +pub static MANIFEST: LazyLock = LazyLock::new(|| { Manifest::from_str(&embed::string!("../../Cargo.toml")) .with_context(|| "Failed to deserialize Cargo manifest") .unwrap() }); +/// Enum used to incidate which page we are on. +pub enum Page { + Home, + About, + Blog, + Contact, + Other, +} + /// Creates a page with the given head and body. /// /// This is the most low level function for page creation @@ -58,6 +68,7 @@ pub fn create(head: Markup, body: Markup) -> Markup { (property("og:url", url)) link rel="canonical" href=(url); + (asset::Css::Shared("page.css")) (head) } diff --git a/src/page/page.css b/src/page/page.css new file mode 100644 index 0000000..fcc5eb9 --- /dev/null +++ b/src/page/page.css @@ -0,0 +1,19 @@ +@font-face { + font-display: block; + font-family: "BaiJam"; + font-weight: normal; + src: url("/assets/BaiJamjureeMedium.woff2"); +} + +@font-face { + font-display: block; + font-family: "BaiJam"; + font-weight: bold; + src: url("/assets/BaiJamjureeBold.woff2"); +} + +html { + background-color: #000000; + color: #FFFFFF; + font-family: "BaiJam"; +} diff --git a/src/page/text/mod.rs b/src/page/text/mod.rs new file mode 100644 index 0000000..0a2bcd8 --- /dev/null +++ b/src/page/text/mod.rs @@ -0,0 +1,40 @@ +use std::{ + env, + path::PathBuf, +}; + +use maud::{ + html, + Markup, +}; + +use crate::page::{ + asset, + Page, +}; + +/// Creates a simple text page. +pub fn create(page: Page, title: &str, body: Markup) -> Markup { + crate::page::create( + html! { + (asset::Css::Shared("text.css")) + }, + html! { + nav { + a href="/" { "HOME" } + a href="/about" { "ABOUT" } + a href="/blog" { "BLOG" } + a href="/contact" { "CONTACT" } + + span.title { (title) } + } + + (body) + + footer { + "Served by " + (env::current_exe().unwrap_or_else(|_| PathBuf::from("asd")).display()) + } + }, + ) +} diff --git a/src/page/text/text.css b/src/page/text/text.css new file mode 100644 index 0000000..e69de29 diff --git a/src/routes/index/index.css b/src/routes/index/index.css index e428d6d..68ae63f 100644 --- a/src/routes/index/index.css +++ b/src/routes/index/index.css @@ -13,6 +13,8 @@ position: absolute; } +/* I do not regret writing this. It's beautiful. */ + .front { background: linear-gradient(to bottom, cyan, blue); } @@ -65,4 +67,4 @@ .left::after { background: linear-gradient(to bottom, cyan, blue); mask-image: linear-gradient(to left, blue, transparent); -} \ No newline at end of file +}