mirror of
https://github.com/RGBCube/Site
synced 2025-08-01 13:37:49 +00:00
Improve CSS a little bit and add proper page titles
This commit is contained in:
parent
e75ff0c0c0
commit
fee81f47ce
13 changed files with 184 additions and 37 deletions
|
@ -18,6 +18,7 @@ pub fn handler<B: 'static>(
|
||||||
|
|
||||||
let response = response.set_body(
|
let response = response.set_body(
|
||||||
cube::create(
|
cube::create(
|
||||||
|
Some("Error"),
|
||||||
asset::Css::Shared("not-found.css"),
|
asset::Css::Shared("not-found.css"),
|
||||||
array::from_fn(|_| {
|
array::from_fn(|_| {
|
||||||
(html! {
|
(html! {
|
||||||
|
|
|
@ -18,6 +18,7 @@ pub fn handler<B: 'static>(
|
||||||
|
|
||||||
let response = response.set_body(
|
let response = response.set_body(
|
||||||
cube::create(
|
cube::create(
|
||||||
|
Some("404"),
|
||||||
asset::Css::Shared("not-found.css"),
|
asset::Css::Shared("not-found.css"),
|
||||||
array::from_fn(|_| {
|
array::from_fn(|_| {
|
||||||
(html! {
|
(html! {
|
||||||
|
|
|
@ -1,8 +1,12 @@
|
||||||
|
html {
|
||||||
|
font-weight: bold;
|
||||||
|
}
|
||||||
|
|
||||||
.face {
|
.face {
|
||||||
display: grid;
|
display: grid;
|
||||||
grid-template-columns: repeat(2, 1fr);
|
grid-template-columns: repeat(2, 1fr);
|
||||||
grid-template-rows: repeat(2, 1fr);
|
grid-template-rows: repeat(2, 1fr);
|
||||||
box-shadow: 0 0 10px #AAAAAA;
|
box-shadow: 0 0 10px whitesmoke;
|
||||||
}
|
}
|
||||||
|
|
||||||
.square {
|
.square {
|
||||||
|
|
|
@ -1,9 +1,3 @@
|
||||||
body,
|
|
||||||
html {
|
|
||||||
height: 100%;
|
|
||||||
margin: 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
html {
|
html {
|
||||||
font-size: 450%;
|
font-size: 450%;
|
||||||
overscroll-behavior: none;
|
overscroll-behavior: none;
|
||||||
|
@ -22,14 +16,17 @@ html {
|
||||||
}
|
}
|
||||||
|
|
||||||
a {
|
a {
|
||||||
/* Black on a white background */
|
/* Black on a white background. */
|
||||||
color: #000000;
|
color: black;
|
||||||
font-weight: bold;
|
}
|
||||||
text-decoration-line: none;
|
|
||||||
|
a:hover {
|
||||||
|
/* The frame changes color only. */
|
||||||
|
color: black;
|
||||||
}
|
}
|
||||||
|
|
||||||
.frame {
|
.frame {
|
||||||
background-color: #FFFFFF;
|
background-color: white;
|
||||||
|
|
||||||
width: min-content;
|
width: min-content;
|
||||||
|
|
||||||
|
@ -61,9 +58,6 @@ a {
|
||||||
}
|
}
|
||||||
|
|
||||||
.face {
|
.face {
|
||||||
background-size: cover;
|
|
||||||
background-position: center;
|
|
||||||
|
|
||||||
width: 5em;
|
width: 5em;
|
||||||
height: 5em;
|
height: 5em;
|
||||||
|
|
||||||
|
@ -98,4 +92,4 @@ a {
|
||||||
|
|
||||||
.left {
|
.left {
|
||||||
transform: rotateY(-89.99999999999999deg) translateZ(2.498em);
|
transform: rotateY(-89.99999999999999deg) translateZ(2.498em);
|
||||||
}
|
}
|
|
@ -12,8 +12,9 @@ use crate::{
|
||||||
/// order of the faces are as so:
|
/// order of the faces are as so:
|
||||||
///
|
///
|
||||||
/// front, top, back, bottom, right, left.
|
/// front, top, back, bottom, right, left.
|
||||||
pub fn create(css: Css, faces: [Markup; 6]) -> Markup {
|
pub fn create(title: Option<&str>, css: Css, faces: [Markup; 6]) -> Markup {
|
||||||
crate::page::create(
|
crate::page::create(
|
||||||
|
title,
|
||||||
html! {
|
html! {
|
||||||
(asset::Css::Shared("cube.css"))
|
(asset::Css::Shared("cube.css"))
|
||||||
(css)
|
(css)
|
||||||
|
|
|
@ -30,12 +30,23 @@ pub enum Page {
|
||||||
Other,
|
Other,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
impl Page {
|
||||||
|
pub fn as_str(self) -> &'static str {
|
||||||
|
match self {
|
||||||
|
Self::Home => "home",
|
||||||
|
Self::About => "about",
|
||||||
|
Self::Blog => "blog",
|
||||||
|
Self::Contact => "contact",
|
||||||
|
Self::Other => "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
|
||||||
/// as all pages use this, as this function provides the
|
/// as all pages use this, as this function provides the
|
||||||
/// page title, OpenGraph and other information.
|
/// page title, OpenGraph and other information.
|
||||||
pub fn create(head: Markup, body: Markup) -> Markup {
|
pub fn create(title: Option<&str>, head: Markup, body: Markup) -> Markup {
|
||||||
html! {
|
html! {
|
||||||
(DOCTYPE)
|
(DOCTYPE)
|
||||||
|
|
||||||
|
@ -47,7 +58,13 @@ pub fn create(head: Markup, body: Markup) -> Markup {
|
||||||
|
|
||||||
@let name = &MANIFEST.package.as_ref().unwrap().authors()[0];
|
@let name = &MANIFEST.package.as_ref().unwrap().authors()[0];
|
||||||
|
|
||||||
title { (name) }
|
title { ({
|
||||||
|
if let Some(title) = title {
|
||||||
|
format!("{title} - {name}")
|
||||||
|
} else {
|
||||||
|
name.clone()
|
||||||
|
}
|
||||||
|
}) }
|
||||||
(pname("author", name))
|
(pname("author", name))
|
||||||
|
|
||||||
(property("og:site_name", name))
|
(property("og:site_name", name))
|
||||||
|
|
|
@ -13,7 +13,23 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
html {
|
html {
|
||||||
background-color: #000000;
|
background-color: black;
|
||||||
color: #FFFFFF;
|
color: white;
|
||||||
font-family: "BaiJam";
|
font-family: "BaiJam";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
body,
|
||||||
|
html {
|
||||||
|
height: 100%;
|
||||||
|
margin: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
a {
|
||||||
|
color: yellow;
|
||||||
|
font-weight: bold;
|
||||||
|
text-decoration-line: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
a:hover {
|
||||||
|
font-style: italic;
|
||||||
|
}
|
|
@ -14,26 +14,32 @@ use crate::page::{
|
||||||
};
|
};
|
||||||
|
|
||||||
/// Creates a simple text page.
|
/// Creates a simple text page.
|
||||||
pub fn create(page: Page, title: &str, body: Markup) -> Markup {
|
pub fn create(title: Option<&str>, page: Page, body: Markup) -> Markup {
|
||||||
crate::page::create(
|
crate::page::create(
|
||||||
|
title,
|
||||||
html! {
|
html! {
|
||||||
(asset::Css::Shared("text.css"))
|
(asset::Css::Shared("text.css"))
|
||||||
|
(asset::Css::Owned(format!(r"
|
||||||
|
.{page} {{
|
||||||
|
font-style: italic !important;
|
||||||
|
}}
|
||||||
|
", page = page.as_str())))
|
||||||
},
|
},
|
||||||
html! {
|
html! {
|
||||||
nav {
|
.not-flex {
|
||||||
a href="/" { "HOME" }
|
nav {
|
||||||
a href="/about" { "ABOUT" }
|
a.home href="/" { "HOME" }
|
||||||
a href="/blog" { "BLOG" }
|
a.about href="/about" { "ABOUT" }
|
||||||
a href="/contact" { "CONTACT" }
|
a.blog href="/blog" { "BLOG" }
|
||||||
|
a.contact href="/contact" { "CONTACT" }
|
||||||
|
}
|
||||||
|
|
||||||
span.title { (title) }
|
(body)
|
||||||
}
|
|
||||||
|
|
||||||
(body)
|
footer {
|
||||||
|
"Served by "
|
||||||
footer {
|
(env::current_exe().unwrap_or_else(|_| PathBuf::from("the toaster in my bathtub")).display())
|
||||||
"Served by "
|
}
|
||||||
(env::current_exe().unwrap_or_else(|_| PathBuf::from("asd")).display())
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
|
|
|
@ -0,0 +1,39 @@
|
||||||
|
html,
|
||||||
|
body {
|
||||||
|
width: 100%;
|
||||||
|
height: 100%;
|
||||||
|
|
||||||
|
display: flex;
|
||||||
|
justify-content: center;
|
||||||
|
}
|
||||||
|
|
||||||
|
.not-flex {
|
||||||
|
display: block;
|
||||||
|
width: min(100vh, 80em);
|
||||||
|
|
||||||
|
margin: 0 1em;
|
||||||
|
}
|
||||||
|
|
||||||
|
nav {
|
||||||
|
font-size: 150%;
|
||||||
|
|
||||||
|
background-color: white;
|
||||||
|
padding: .3em .6em;
|
||||||
|
|
||||||
|
border-bottom-left-radius: 1em;
|
||||||
|
border-bottom-right-radius: 1em;
|
||||||
|
}
|
||||||
|
|
||||||
|
nav a {
|
||||||
|
color: black;
|
||||||
|
font-style: normal;
|
||||||
|
margin-right: .6em;
|
||||||
|
}
|
||||||
|
|
||||||
|
nav a:last-child {
|
||||||
|
margin-right: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
footer {
|
||||||
|
margin-bottom: 3em;
|
||||||
|
}
|
63
src/routes/about.rs
Normal file
63
src/routes/about.rs
Normal file
|
@ -0,0 +1,63 @@
|
||||||
|
use actix_web::get;
|
||||||
|
use maud::{
|
||||||
|
html,
|
||||||
|
Markup,
|
||||||
|
};
|
||||||
|
|
||||||
|
use crate::page::{
|
||||||
|
text,
|
||||||
|
Page,
|
||||||
|
};
|
||||||
|
|
||||||
|
#[get("/about")]
|
||||||
|
pub async fn handler() -> actix_web::Result<Markup> {
|
||||||
|
Ok(text::create(
|
||||||
|
Some("About"),
|
||||||
|
Page::About,
|
||||||
|
html! {
|
||||||
|
h1 { "Lorem Ipsum" }
|
||||||
|
p {
|
||||||
|
"Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed eget justo nec libero finibus facilisis. Curabitur fermentum quam et neque faucibus, nec pharetra nunc hendrerit."
|
||||||
|
}
|
||||||
|
h2 { "Section 1" }
|
||||||
|
p {
|
||||||
|
"Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia Curae; Donec auctor velit id lectus vehicula molestie."
|
||||||
|
}
|
||||||
|
h3 { "Subsection 1.1" }
|
||||||
|
p {
|
||||||
|
"Nullam mollis nunc non nisl fermentum, a varius eros viverra. Fusce condimentum felis vitae nibh vehicula, a tincidunt ipsum eleifend."
|
||||||
|
}
|
||||||
|
h2 { "Section 2" }
|
||||||
|
p {
|
||||||
|
"Phasellus euismod eros a elit volutpat, sed volutpat eros placerat. Sed dictum est et metus consectetur, quis fringilla nunc venenatis."
|
||||||
|
}
|
||||||
|
h3 { "Subsection 2.1" }
|
||||||
|
p {
|
||||||
|
"Integer ac libero id nisi posuere bibendum. Vivamus ut enim auctor, scelerisque quam a, fermentum ligula."
|
||||||
|
}
|
||||||
|
h3 { "Subsection 2.2" }
|
||||||
|
p {
|
||||||
|
"Morbi ut ex vel odio congue lobortis sit amet vel lacus. Duis rhoncus risus eget justo tincidunt vehicula."
|
||||||
|
}
|
||||||
|
h2 { "Section 3" }
|
||||||
|
p {
|
||||||
|
"Etiam quis sapien quis lacus malesuada vestibulum. Nam bibendum risus sed dui maximus, sed posuere lorem ultricies."
|
||||||
|
}
|
||||||
|
h3 { "Subsection 3.1" }
|
||||||
|
p {
|
||||||
|
"Cras interdum arcu at dolor dictum, a posuere urna aliquam. Vestibulum nec tortor nec nunc cursus lobortis sit amet a arcu."
|
||||||
|
}
|
||||||
|
h3 { "Subsection 3.2" }
|
||||||
|
p {
|
||||||
|
"Nunc auctor mauris quis lacus molestie lobortis. Vivamus eu sapien vel ligula congue convallis."
|
||||||
|
}
|
||||||
|
p {
|
||||||
|
a href="#" { "Link 1" }
|
||||||
|
" | "
|
||||||
|
a href="#" { "Link 2" }
|
||||||
|
" | "
|
||||||
|
a href="#" { "Link 3" }
|
||||||
|
}
|
||||||
|
},
|
||||||
|
))
|
||||||
|
}
|
|
@ -1,5 +1,9 @@
|
||||||
|
a:hover {
|
||||||
|
font-style: normal;
|
||||||
|
}
|
||||||
|
|
||||||
.frame:hover {
|
.frame:hover {
|
||||||
background-color: #FFFF00;
|
background-color: yellow;
|
||||||
}
|
}
|
||||||
|
|
||||||
.face::after {
|
.face::after {
|
||||||
|
|
|
@ -12,6 +12,7 @@ use crate::{
|
||||||
#[get("/")]
|
#[get("/")]
|
||||||
pub async fn handler() -> actix_web::Result<Markup> {
|
pub async fn handler() -> actix_web::Result<Markup> {
|
||||||
Ok(cube::create(
|
Ok(cube::create(
|
||||||
|
None,
|
||||||
asset::css::owned!("index.css"),
|
asset::css::owned!("index.css"),
|
||||||
[
|
[
|
||||||
html! {
|
html! {
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
// mod about;
|
mod about;
|
||||||
mod assets;
|
mod assets;
|
||||||
mod index;
|
mod index;
|
||||||
|
|
||||||
|
@ -10,6 +10,6 @@ use actix_web::{
|
||||||
pub fn handler() -> Scope {
|
pub fn handler() -> Scope {
|
||||||
web::scope("")
|
web::scope("")
|
||||||
.service(index::handler)
|
.service(index::handler)
|
||||||
// .service(about::handler)
|
.service(about::handler)
|
||||||
.service(assets::handler)
|
.service(assets::handler)
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue