Add a footer

This commit is contained in:
Tyler Hallada 2023-09-01 20:13:44 -04:00
parent a8742c882e
commit 0607b46283
4 changed files with 34 additions and 8 deletions

View File

@ -34,6 +34,19 @@ header.header nav ul li {
margin-left: 16px; margin-left: 16px;
} }
/* Footer */
footer.footer {
text-align: center;
margin-top: 64px;
margin-bottom: 16px;
}
footer.footer hr {
width: 64px;
margin-bottom: 16px;
}
/* Home */ /* Home */
ul.entries { ul.entries {

10
src/partials/footer.rs Normal file
View File

@ -0,0 +1,10 @@
use maud::{html, Markup};
pub fn footer() -> Markup {
html! {
footer class="footer" {
hr;
"Made by " a href="https://www.hallada.net" { "Tyler Hallada" }"."
}
}
}

View File

@ -1,5 +1,5 @@
use std::path::Path;
use std::fs; use std::fs;
use std::path::Path;
#[cfg(not(debug_assertions))] #[cfg(not(debug_assertions))]
use std::str::Lines; use std::str::Lines;
@ -11,10 +11,10 @@ use axum::{
}; };
use maud::{html, Markup, DOCTYPE}; use maud::{html, Markup, DOCTYPE};
#[cfg(not(debug_assertions))]
use crate::{JS_BUNDLES, CSS_BUNDLES};
use crate::config::Config;
use crate::partials::header::header; use crate::partials::header::header;
use crate::{config::Config, partials::footer::footer};
#[cfg(not(debug_assertions))]
use crate::{CSS_BUNDLES, JS_BUNDLES};
pub struct Layout { pub struct Layout {
pub title: String, pub title: String,
@ -38,11 +38,11 @@ where
} }
} }
// In development, the JS and CSS file names are retrieved at runtime during Layout::render so that // In development, the JS and CSS file names are retrieved at runtime during Layout::render so that
// the server binary does not need to be rebuilt when frontend files are changed. // the server binary does not need to be rebuilt when frontend files are changed.
// //
// In release mode, this work is done ahead of time in build.rs and saved to static/js/manifest.txt // In release mode, this work is done ahead of time in build.rs and saved to static/js/manifest.txt
// and static/css/manifest.txt. The contents of those files are then compiled into the server // and static/css/manifest.txt. The contents of those files are then compiled into the server
// binary so that rendering the Layout does not need to do any filesystem operations. // binary so that rendering the Layout does not need to do any filesystem operations.
fn get_bundles(asset_type: &str) -> Vec<String> { fn get_bundles(asset_type: &str) -> Vec<String> {
let root_dir = Path::new("./"); let root_dir = Path::new("./");
@ -63,7 +63,8 @@ fn get_bundles(asset_type: &str) -> Vec<String> {
.join(entry.path().strip_prefix(root_dir).unwrap()) .join(entry.path().strip_prefix(root_dir).unwrap())
.display() .display()
.to_string() .to_string()
}).collect() })
.collect()
} }
#[cfg(debug_assertions)] #[cfg(debug_assertions)]
@ -104,6 +105,7 @@ impl Layout {
body hx-booster="true" { body hx-booster="true" {
(header(&self.title)) (header(&self.title))
(template) (template)
(footer())
} }
} }
} }

View File

@ -3,6 +3,7 @@ pub mod entry_link;
pub mod entry_list; pub mod entry_list;
pub mod feed_link; pub mod feed_link;
pub mod feed_list; pub mod feed_list;
pub mod footer;
pub mod header; pub mod header;
pub mod layout; pub mod layout;
pub mod opml_import_form; pub mod opml_import_form;