aboutsummaryrefslogtreecommitdiff
path: root/pkg/tpl/layout.templ
diff options
context:
space:
mode:
Diffstat (limited to 'pkg/tpl/layout.templ')
-rw-r--r--pkg/tpl/layout.templ49
1 files changed, 49 insertions, 0 deletions
diff --git a/pkg/tpl/layout.templ b/pkg/tpl/layout.templ
new file mode 100644
index 0000000..4993b97
--- /dev/null
+++ b/pkg/tpl/layout.templ
@@ -0,0 +1,49 @@
+package tpl
+
+import "go.neonxp.ru/framework/pkg/utils"
+
+templ Layout() {
+ {{ user := utils.GetUserCtx(ctx) }}
+ <!DOCTYPE html>
+ <html lang="en">
+ <head>
+ <meta charset="utf-8"/>
+ <meta name="viewport" content="width=device-width, initial-scale=1"/>
+ <meta name="color-scheme" content="light dark"/>
+ <link rel="stylesheet" href="/css/pico/pico.blue.min.css"/>
+ <link rel="stylesheet" href="/css/style.css"/>
+ <link rel="stylesheet" href="/css/fork-awesome.min.css"/>
+ <title>App</title>
+ </head>
+ <body>
+ <main class="container">
+ <nav>
+ <ul>
+ <li><a href="/"><strong>App</strong></a></li>
+ <li><span aria-busy="true" id="loader" class="htmx-indicator">Загрузка...</span></li>
+ </ul>
+ <ul hx-boost="true" hx-indicator="#loader">
+ if user == nil {
+ <li><a href="/user/login">Вход</a></li>
+ <li><a href="/user/register">Регистрация</a></li>
+ } else {
+ <li><a href="/user/profile">{ user.Username }</a></li>
+ <li><a href="#" hx-post="/user/logout">Выход</a></li>
+ }
+ </ul>
+ </nav>
+ { children... }
+ </main>
+ </body>
+ <footer>
+ <main class="container">
+ <nav>
+ <ul>
+ <li>Сделал <a href="https://neonxp.ru/">NeonXP</a> в 2024 году.</li>
+ </ul>
+ </nav>
+ </main>
+ </footer>
+ <script src="/js/htmx.min.js"></script>
+ </html>
+}