1
Fork 0
mirror of https://github.com/RGBCube/Site synced 2025-08-01 13:37:49 +00:00

Add page::text

This commit is contained in:
RGBCube 2024-01-05 16:04:17 +03:00
parent 0fc2afb396
commit 1f6c5ebddd
No known key found for this signature in database
9 changed files with 78 additions and 12 deletions

1
.gitignore vendored
View file

@ -6,6 +6,7 @@
!src/errors/not_found/ !src/errors/not_found/
!src/page/ !src/page/
!src/page/cube/ !src/page/cube/
!src/page/text/
!src/routes/ !src/routes/
!src/routes/index/ !src/routes/index/

Binary file not shown.

View file

@ -1,9 +1,3 @@
@font-face {
font-family: "Bai Jamjuree";
font-weight: 700;
src: url("/assets/BaiJamjuree700.woff2") format("woff2");
}
body, body,
html { html {
height: 100%; height: 100%;
@ -11,10 +5,7 @@ html {
} }
html { html {
background-color: #000000;
font-family: "Bai Jamjuree", sans;
font-size: 450%; font-size: 450%;
overscroll-behavior: none; overscroll-behavior: none;
} }
@ -31,7 +22,9 @@ html {
} }
a { a {
/* Black on a white background */
color: #000000; color: #000000;
font-weight: bold;
text-decoration-line: none; text-decoration-line: none;
} }
@ -105,4 +98,4 @@ a {
.left { .left {
transform: rotateY(-89.99999999999999deg) translateZ(2.498em); transform: rotateY(-89.99999999999999deg) translateZ(2.498em);
} }

View file

@ -1,5 +1,6 @@
pub mod cube; pub mod cube;
mod elements; mod elements;
pub mod text;
use std::sync::LazyLock; use std::sync::LazyLock;
@ -14,12 +15,21 @@ use maud::{
use crate::asset; use crate::asset;
static MANIFEST: LazyLock<Manifest> = LazyLock::new(|| { pub static MANIFEST: LazyLock<Manifest> = LazyLock::new(|| {
Manifest::from_str(&embed::string!("../../Cargo.toml")) Manifest::from_str(&embed::string!("../../Cargo.toml"))
.with_context(|| "Failed to deserialize Cargo manifest") .with_context(|| "Failed to deserialize Cargo manifest")
.unwrap() .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. /// Creates a page with the given head and body.
/// ///
/// This is the most low level function for page creation /// 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)) (property("og:url", url))
link rel="canonical" href=(url); link rel="canonical" href=(url);
(asset::Css::Shared("page.css"))
(head) (head)
} }

19
src/page/page.css Normal file
View file

@ -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";
}

40
src/page/text/mod.rs Normal file
View file

@ -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())
}
},
)
}

0
src/page/text/text.css Normal file
View file

View file

@ -13,6 +13,8 @@
position: absolute; position: absolute;
} }
/* I do not regret writing this. It's beautiful. */
.front { .front {
background: linear-gradient(to bottom, cyan, blue); background: linear-gradient(to bottom, cyan, blue);
} }
@ -65,4 +67,4 @@
.left::after { .left::after {
background: linear-gradient(to bottom, cyan, blue); background: linear-gradient(to bottom, cyan, blue);
mask-image: linear-gradient(to left, blue, transparent); mask-image: linear-gradient(to left, blue, transparent);
} }