scanfile/server/web/base.templ
2025-05-27 15:00:19 +02:00

67 lines
2 KiB
Text

package web
import (
"github.com/spf13/viper"
)
templ Base(title string) {
<!DOCTYPE html>
<html lang="en">
<head>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta charset="utf-8"/>
<title>{title}</title>
<link rel="stylesheet" href="/assets/terminal.css"/>
</head>
<body>
<header>
@NavBar(title)
</header>
<main class="flex-grow">
<div class="container mx-auto px-4 py-8 sm:px-6 lg:px-8 max-w-8xl">
{ children... }
</div>
</main>
<footer class="bg-gray-800 text-gray-300 py-4">
<div class="container mx-auto text-center">
<p>{viper.GetString("ui.name")} by <a href={templ.URL(viper.GetString("ui.byurl"))}>{viper.GetString("ui.byname")}</a> licenced under GPLv2, </p>
<p><a href={templ.URL(viper.GetString("ui.source"))}>Source</a></p>
</div>
<script src="/assets/htmx.min.js"></script>
<script src="/assets/alpine.min.js"></script>
</footer>
</body>
</html>
}
templ NavBar(title string) {
<nav class="bg-blue-600 p-4 shadow-lg">
<div class="container mx-auto flex justify-between items-center">
<!-- Logo or Brand Name -->
<a href="/" class="text-white text-lg font-bold">
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-search"><circle cx="11" cy="11" r="8"></circle><line x1="21" y1="21" x2="16.65" y2="16.65"></line></svg>
</a>
<!-- Navigation Links -->
<div class="flex space-x-4">
<a
href="/"
class="text-white hover:bg-blue-700 px-3 py-2 rounded-md"
>
Home
</a>
<a
href="/about"
class="text-white hover:bg-blue-700 px-3 py-2 rounded-md"
>
About
</a>
<a
href="/login"
class="text-white hover:bg-blue-700 px-3 py-2 rounded-md"
>
Login
</a>
</div>
</div>
</nav>
}