This commit is contained in:
JOLIMAITRE Matthieu 2024-07-25 01:24:41 +02:00
commit 3f461e8375
6 changed files with 1571 additions and 0 deletions

91
src/common.rs Normal file
View file

@ -0,0 +1,91 @@
use axum::response::IntoResponse;
use maud::{html, Markup};
use stylist::{css, GlobalStyle};
pub fn head(title: &str) -> Markup {
html!(
head {
title { "Recueil " (title) }
link rel = "stylesheet" href = "/style.css";
}
)
}
pub fn header() -> Markup {
html!(
header {
a href = "/" { h1 { "Motifs" } }
a href = "/activity" { "activité" }
a href = "/topics" { "sujets" }
}
)
}
pub fn footer() -> Markup {
html!(
footer {
a href = "https://barnulf.net" { "barnulf.net" }
p { "Propulsé par la rouille." }
}
)
}
pub async fn style() -> impl IntoResponse {
#[allow(non_upper_case_globals)]
let style = GlobalStyle::new(css!(
page, html, body, content {
padding: 0;
border: 0;
margin: 0;
overflow-x: hidden;
}
body {
background-color: #181818;
color: white;
display: grid;
place-items: start center;
}
content {
background-color: #202020;
min-height: 100vh;
width: 100vw;
max-width: 1000px;
border-left: 1px solid #ffffff16;
border-right: 1px solid #ffffff16;
display: grid;
grid-template-rows: auto 1fr auto;
}
header {
border-bottom: 1px solid #ffffff16;
display: flex;
place-items: center;
padding-left: 2rem;
gap: 2rem;
}
a {
color: wheat;
}
main {
padding: 2rem;
}
footer {
border-top: 1px solid #ffffff16;
display: flex;
place-items: center;
padding-left: 2rem;
gap: 2rem;
}
))
.expect("Fails to compile style.")
.get_style_str()
.to_string();
([("content-type", "style/css")], style)
}