aboutsummaryrefslogblamecommitdiff
path: root/pkg/tpl/layout.templ
blob: 4993b97f90dd5ea3c4f92e14f9703f08241450d7 (plain) (tree)
















































                                                                                                                                             
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>
}