File size: 1,396 Bytes
c1a5b70
0ec8914
 
 
 
c1a5b70
0ec8914
c1a5b70
 
 
 
 
 
 
 
7206e7d
0ec8914
 
 
 
 
 
 
 
 
 
7206e7d
 
 
0ec8914
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
//! A module that handles the header for all the pages in the `websurfx` frontend.

use crate::templates::partials::navbar::navbar;
use maud::{html, Markup, PreEscaped, DOCTYPE};

/// A function that handles the html code for the header for all the pages in the search engine frontend.
///
/// # 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.
pub fn header(colorscheme: &str, theme: &str, animation: &Option<String>) -> Markup {
    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";
            @if animation.is_some() {
                    link href=(format!("static/animations/{}.css", animation.as_ref().unwrap())) rel="stylesheet" type="text/css";
            }
        }

        (PreEscaped("<body onload=\"getClientSettings()\">"))
            header{
                h1{a href="/"{"Websurfx"}}
                (navbar())
            }
    )
}