diff options
author | Alexander Neonxp Kiryukhin <i@neonxp.ru> | 2024-10-12 02:52:22 +0300 |
---|---|---|
committer | Alexander Neonxp Kiryukhin <i@neonxp.ru> | 2024-10-12 02:53:52 +0300 |
commit | d05ea66f4bbcf0cc5c8908f3435c68de1b070fa1 (patch) | |
tree | 7c7a769206646f2b81a0eda0680f0be5033a4197 /pkg/tpl/layout.templ |
Начальная версияv0.0.1
Diffstat (limited to 'pkg/tpl/layout.templ')
-rw-r--r-- | pkg/tpl/layout.templ | 49 |
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> +} |