You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
33 lines
1002 B
33 lines
1002 B
use maud::{html, Markup, Render};
|
|
|
|
pub struct HeaderLink {
|
|
pub path: String,
|
|
pub name: String,
|
|
pub prefix: Option<String>,
|
|
pub postfix: Option<String>,
|
|
}
|
|
|
|
pub struct Header(pub Vec<HeaderLink>, pub String);
|
|
|
|
impl Render for Header {
|
|
fn render(&self) -> Markup {
|
|
html! {
|
|
header .page-header {
|
|
@for header_part in &self.0 {
|
|
@if let Some(prefix) = header_part.prefix.clone() {
|
|
div .header-separator { (prefix) }
|
|
}
|
|
@if header_part.path == self.1 {
|
|
div .selected-header { (header_part.name) }
|
|
} @else {
|
|
a .unselected-header href=(header_part.path) { (header_part.name) }
|
|
}
|
|
@if let Some(postfix) = header_part.postfix.clone() {
|
|
div .header-separator { (postfix) }
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|