"use strict"; const NAV_MENU_ITEMS = [ ["/public/", "Accueil"], ["/public/games/", "Jeux"], ["/public/software-development/", "Software"], [ "/public/education/", "Pédagogie", [ // submenu ["/public/education/#game-studio-club", "Game Studio Club"], ["/public/education/#popularization", "Animations vulgarisation"], ], ], ]; class Template { constructor(props) { this.props = props; } renderMenu(menuItemsArray, isSubmenu = false) { const r = { tag: "ul", class: isSubmenu ? "submenu" : "", contents: menuItemsArray.map(link => { const [href, text, submenu] = link; return { tag: "li", class: !isSubmenu && window.location.pathname === href ? "active" : "", contents: [{ tag: "a", href, contents: text }].concat( submenu ? [this.renderMenu(submenu, true)] : [] ), }; }), }; return r; } render() { return { tag: "main", contents: [ { tag: "header", contents: [ { tag: "nav", contents: [this.renderMenu(NAV_MENU_ITEMS)], }, ], }, { 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;