framework/pkg/tpl/layout.templ

50 lines
1.3 KiB
Text
Raw Normal View History

2024-10-12 02:52:22 +03:00
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>
}