diff options
Diffstat (limited to 'templates/base.templ')
-rw-r--r-- | templates/base.templ | 59 |
1 files changed, 0 insertions, 59 deletions
diff --git a/templates/base.templ b/templates/base.templ deleted file mode 100644 index e6c4a1d..0000000 --- a/templates/base.templ +++ /dev/null @@ -1,59 +0,0 @@ -package templates - -import "git.thomasvoss.com/euro-cash.eu/i18n" - -templ Base(head, body templ.Component) { - {{ p := ctx.Value("printer").(i18n.Printer) }} - <!DOCTYPE html> - <html lang={ p.Locale.Bcp }> - <head> - <meta charset="UTF-8"/> - <meta name="viewport" content="width=device-width, initial-scale=1.0"/> - <link rel="stylesheet" type="text/css" href="/style.css"/> - <title>Euro Cash</title> - <script type="text/javascript"> - const validate = theme => - ["light", "dark"].includes(theme) ? theme : "light"; - - const toggle = theme => - theme == "light" ? "dark" : "light"; - - const setTheme = theme => { - localStorage.setItem("theme", theme); - document - .getElementsByTagName("html")[0] - .setAttribute("data-theme", theme); - document - .getElementById(`nav-icon-theme-${theme}`) - .style.display = ''; - document - .getElementById(`nav-icon-theme-${toggle(theme)}`) - .style.display = 'none'; - }; - - document.addEventListener('DOMContentLoaded', _ => { - document.getElementById("theme-button").onclick = () => { - setTheme(toggle(validate(localStorage.getItem("theme")))); - }; - setTheme(validate(localStorage.getItem("theme"))); - }); - </script> - if head != nil { - @head - } - </head> - <body> - if body != nil { - @body - } - <footer> - <p> - <small> - { p.T("Found a mistake or want to contribute missing information?") } - <a href="/">{ p.T("Feel free to contact us!") }</a> - </small> - </p> - </footer> - </body> - </html> -} |