t2/views/components/navbar.templ

44 lines
1.9 KiB
Plaintext

package components
import "gitea.henriburau.de/haw-lan/cod4watcher/views"
import "strings"
import "fmt"
templ Nagivation() {
<nav class="bg-gray-800">
<div class="mx-auto max-w-7xl">
<div class="relative flex h-16 items-center justify-between">
<div class="flex flex-1 items-center justify-center sm:items-stretch sm:justify-start">
<div class="flex flex-shrink-0 items-center">
<span class="text-white pr-2 font-bold">Turnier-Tracker</span>
<img class="h-8 w-auto" src="/assets/logo.svg" alt="Your Company"/>
</div>
<div class="hidden sm:ml-6 sm:block">
<div class="flex space-x-4">
<!-- Current: "bg-gray-900 text-white", Default: "text-gray-300 hover:bg-gray-700 hover:text-white" -->
if ctx.Value(views.PathContext) == "" || ctx.Value(views.PathContext) == "/" {
<a href="/" class="bg-gray-900 text-white rounded-md px-3 py-2 text-sm font-medium" aria-current="page">Dashboard</a>
} else {
<a href="/" class="text-gray-300 hover:bg-gray-700 hover:text-white rounded-md px-3 py-2 text-sm font-medium">Dashboard</a>
}
<!--
<a href="/about" class="text-gray-300 hover:bg-gray-700 hover:text-white rounded-md px-3 py-2 text-sm font-medium">About</a>
-->
</div>
</div>
</div>
<div class="absolute inset-y-0 right-0 flex items-center pr-2 sm:static sm:inset-auto sm:ml-6 sm:pr-0">
if views.Username(ctx) != "" {
<div class="bg-gray-300 rounded-full mx-3 w-6 h-6 flex items-center justify-center">
<span class="block text-gray-800 font-bold">{ fmt.Sprintf("%c", strings.ToUpper(views.Username(ctx))[0]) }</span>
</div>
<a href="/logout" class="text-gray-300 hover:bg-gray-700 hover:text-white rounded-md px-3 py-2 text-sm font-medium">Logout</a>
} else {
<a href="/login" class="text-gray-300 hover:bg-gray-700 hover:text-white rounded-md px-3 py-2 text-sm font-medium">Login</a>
}
</div>
</div>
</div>
</nav>
}