summary refs log tree commit diff
path: root/src/components/layout/mod.rs
blob: cc524e92ffd87be177952cd082d23056a44b253b (plain)
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
40
41
use morgana::{morx, Component, RenderNode};

stylance::import_crate_style!(styles, "src/components/layout/layout.module.css");

pub struct Layout {
    pub children: Vec<RenderNode>,
    pub page_title: String,
    pub site_title: String,
}

impl Component for Layout {
    fn render(self: Box<Self>) -> RenderNode {
        morx! {
            html lang="html" {
                head {
                    title ={self.page_title}
                }
                body {
                    div class={styles::layout} {
                        header {
                            a href="/" id="siteTitle" {
                                ={self.site_title}
                            }
                        }

                        nav {
                            p= "Nav"
                        }

                        main ={self.children}

                        footer {
                            p= "Footer"
                        }
                    }
                }
            }
        }
    }
}