Files
projectreshoot/view/component/nav/navbarright.templ

58 lines
1.3 KiB
Plaintext

package nav
import "projectreshoot/contexts"
// Returns the right portion of the navbar
templ navRight() {
{{ user := contexts.GetUser(ctx) }}
<div class="flex items-center gap-2">
<div class="sm:flex sm:gap-2">
if user != nil {
<a
class="hidden rounded-lg px-4 py-2 sm:block
bg-sapphire hover:bg-sapphire/75 text-mantle transition"
href="#"
>
{ user.Username }
</a>
} else {
<a
class="hidden rounded-lg px-4 py-2 sm:block
bg-green hover:bg-green/75 text-mantle transition"
href="/login"
>
Login
</a>
<a
class="hidden rounded-lg px-4 py-2 sm:block
bg-blue text-mantle hover:bg-blue/75 transition"
href="/register"
>
Register
</a>
}
</div>
<button
@click="open = !open"
class="block rounded-lg p-2.5 sm:hidden transition
bg-surface0 text-subtext0 hover:text-overlay2/75"
>
<span class="sr-only">Toggle menu</span>
<svg
xmlns="http://www.w3.org/2000/svg"
class="size-5"
fill="none"
viewBox="0 0 24 24"
stroke="currentColor"
stroke-width="2"
>
<path
stroke-linecap="round"
stroke-linejoin="round"
d="M4 6h16M4 12h16M4 18h16"
></path>
</svg>
</button>
</div>
}