summaryrefslogtreecommitdiff
path: root/src/handlers/frontend.rs
diff options
context:
space:
mode:
authorWriterV2 <primary-v2@protonmail.com>2024-10-27 13:58:51 +0100
committerWriterV2 <primary-v2@protonmail.com>2024-10-27 14:00:34 +0100
commit04e19765aca471fd85199714699aaf827d04608d (patch)
treea2bfa782c1db2a6b783206087309a9eed3c6e9b9 /src/handlers/frontend.rs
parente074949d96fe29929e99890b3035dc1a5ba57184 (diff)
Refactor: Organize modules initially
Diffstat (limited to 'src/handlers/frontend.rs')
-rw-r--r--src/handlers/frontend.rs37
1 files changed, 37 insertions, 0 deletions
diff --git a/src/handlers/frontend.rs b/src/handlers/frontend.rs
new file mode 100644
index 0000000..f4b7c6c
--- /dev/null
+++ b/src/handlers/frontend.rs
@@ -0,0 +1,37 @@
+use axum::response::IntoResponse;
+use maud::{html, Markup, DOCTYPE};
+
+use crate::error::AppError;
+
+pub async fn home() -> Result<impl IntoResponse, AppError> {
+ Ok(html!({
+ (head("Home"))
+ body class="bg-[#eae3d2] text-[#333] dark:bg-[#333] dark:text-[#eae3d2] font-mono text-base tracking-wide" {
+ (header_with_navbar())
+ }
+ }))
+}
+
+fn header_with_navbar() -> Markup {
+ html!({
+ header {
+ navbar class="p-3 text-sm flex flex-row flex-wrap content-center justify-around decoration-purple-500 shadow" {
+ a class="hover:underline" href="/" { "Home" }
+ a class="hover:underline" href="/" { "Stories" }
+ a class="hover:underline" href="/" { "Tools" }
+ a class="hover:underline" href="/" { "Games" }
+ }
+ }
+ })
+}
+
+fn head(page_title: &str) -> Markup {
+ html! {
+ head {
+ (DOCTYPE)
+ meta charset="utf-8";
+ link rel="stylesheet" type="text/css" href="/static/styles.css";
+ title { (page_title) }
+ }
+ }
+}