Pour tout problème contactez-nous par mail : support@froggit.fr | La FAQ | Rejoignez-nous sur le Chat 💬

Skip to content
Snippets Groups Projects
template.js 2.02 KiB
Newer Older
  • Learn to ignore specific revisions
  • peter_rabbit's avatar
    peter_rabbit committed
    "use strict";
    
    class Template {
        constructor(props) {
            this.props = props;
        }
    
        render() {
            return {
                tag: "main",
                contents: [
                    {
                        tag: "header",
                        contents: [
                            {
    
                                tag: "nav",
    
    peter_rabbit's avatar
    peter_rabbit committed
                                contents: [
                                    {
    
                                        tag: "ul",
    
    peter_rabbit's avatar
    peter_rabbit committed
                                        contents: [
    
                                            ["/public/", "Accueil"],
                                            ["/public/games/", "Jeux"],
                                            ["/public/software-development/", "Software"],
                                            ["/public/education/", "Pédagogie"],
                                        ].map(link => {
                                            const [href, text] = link;
                                            return {
                                                tag: "li",
                                                class:
                                                    window.location.pathname === href ? "active" : "",
                                                contents: [{ tag: "a", href, contents: text }],
                                            };
                                        }),
    
    peter_rabbit's avatar
    peter_rabbit committed
                                    },
                                ],
                            },
                        ],
                    },
                    {
                        tag: "div",
                        id: "page-container",
                        contents: [this.props.page.render()],
                    },
                    {
                        tag: "footer",
                        contents: [
                            {
                                tag: "a",
                                href: "mailto:kuadrado-software@tutanota.com",
                                contents: "kuadrado-software@tutanota.com",
                            },
                        ],
                    },
                ],
            };
        }
    }
    
    module.exports = Template;