2023-11-18 21:23:22 +03:00
|
|
|
//! A module that handles the header for all the pages in the `websurfx` frontend.
|
2023-11-17 22:10:06 +03:00
|
|
|
|
|
|
|
use crate::templates::partials::navbar::navbar;
|
|
|
|
use maud::{html, Markup, PreEscaped, DOCTYPE};
|
|
|
|
|
2023-11-18 21:23:22 +03:00
|
|
|
/// A function that handles the html code for the header for all the pages in the search engine frontend.
|
2023-11-17 22:10:06 +03:00
|
|
|
///
|
2023-11-18 21:23:22 +03:00
|
|
|
/// # Arguments
|
|
|
|
///
|
|
|
|
/// * `colorscheme` - It takes the colorscheme name as an argument.
|
|
|
|
/// * `theme` - It takes the theme name as an argument.
|
|
|
|
///
|
|
|
|
/// # Returns
|
|
|
|
///
|
|
|
|
/// It returns the compiled html markup code for the header as a result.
|
2023-12-11 21:17:23 +03:00
|
|
|
pub fn header(colorscheme: &str, theme: &str, animation: &Option<String>) -> Markup {
|
2023-11-17 22:10:06 +03:00
|
|
|
html!(
|
|
|
|
(DOCTYPE)
|
|
|
|
html lang="en"
|
|
|
|
|
|
|
|
head{
|
|
|
|
title{"Websurfx"}
|
|
|
|
meta charset="UTF-8";
|
|
|
|
meta name="viewport" content="width=device-width, initial-scale=1";
|
|
|
|
link href=(format!("static/colorschemes/{colorscheme}.css")) rel="stylesheet" type="text/css";
|
|
|
|
link href=(format!("static/themes/{theme}.css")) rel="stylesheet" type="text/css";
|
2023-12-11 21:17:23 +03:00
|
|
|
@if animation.is_some() {
|
|
|
|
link href=(format!("static/animations/{}.css", animation.as_ref().unwrap())) rel="stylesheet" type="text/css";
|
|
|
|
}
|
2023-11-17 22:10:06 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
(PreEscaped("<body onload=\"getClientSettings()\">"))
|
|
|
|
header{
|
|
|
|
h1{a href="/"{"Websurfx"}}
|
|
|
|
(navbar())
|
|
|
|
}
|
|
|
|
)
|
|
|
|
}
|