2023-10-28 10:45:47 -04:00
|
|
|
package templates
|
|
|
|
|
2023-10-29 19:10:32 -04:00
|
|
|
import (
|
|
|
|
"git.preston-baxter.com/Preston_PLB/capstone/frontend-service/db/models"
|
|
|
|
)
|
|
|
|
|
2023-10-28 11:15:42 -04:00
|
|
|
templ navTitle(title string) {
|
|
|
|
<a
|
|
|
|
class="text-sm font-bold leading-relaxed inline-block mr-4 py-2 whitespace-nowrap uppercase text-white"
|
|
|
|
href="/"
|
|
|
|
>
|
|
|
|
{ title }
|
|
|
|
</a>
|
|
|
|
<button
|
|
|
|
class="cursor-pointer text-xl leading-none px-3 py-1 border border-solid border-transparent rounded bg-transparent block lg:hidden outline-none focus:outline-none"
|
|
|
|
type="button"
|
|
|
|
onclick="toggleNavbar('example-collapse-navbar')"
|
|
|
|
>
|
|
|
|
<i class="text-white fas fa-bars"></i>
|
|
|
|
</button>
|
|
|
|
}
|
|
|
|
|
|
|
|
templ navItem(name string, link string) {
|
|
|
|
<li class="flex items-center">
|
|
|
|
<a
|
|
|
|
class="lg:text-white lg:hover:text-gray-300 text-gray-800 px-3 py-4 lg:py-2 flex items-center text-xs uppercase font-bold"
|
|
|
|
href="{ link }"
|
|
|
|
>
|
|
|
|
{ name }
|
|
|
|
</a>
|
|
|
|
</li>
|
|
|
|
}
|
|
|
|
|
|
|
|
templ navActionItem(auth bool) {
|
|
|
|
<li class="flex items-center">
|
|
|
|
if auth {
|
2023-10-29 19:10:32 -04:00
|
|
|
<a href="/dashboard">
|
|
|
|
<button
|
|
|
|
class="bg-white text-gray-800 active:bg-gray-100 text-xs font-bold uppercase px-4 py-2 rounded shadow hover:shadow-md outline-none focus:outline-none lg:mr-1 lg:mb-0 ml-3 mb-3"
|
|
|
|
type="button"
|
|
|
|
style="transition: all 0.15s ease 0s;"
|
|
|
|
>
|
|
|
|
Dashboard
|
|
|
|
</button>
|
|
|
|
</a>
|
2023-10-28 11:15:42 -04:00
|
|
|
} else {
|
|
|
|
<a href="/login">
|
2023-10-28 10:45:47 -04:00
|
|
|
<button
|
2023-10-28 11:15:42 -04:00
|
|
|
class="bg-white text-gray-800 active:bg-gray-100 text-xs font-bold uppercase px-4 py-2 rounded shadow hover:shadow-md outline-none focus:outline-none lg:mr-1 lg:mb-0 ml-3 mb-3"
|
2023-10-28 10:45:47 -04:00
|
|
|
type="button"
|
2023-10-28 11:15:42 -04:00
|
|
|
style="transition: all 0.15s ease 0s;"
|
2023-10-28 10:45:47 -04:00
|
|
|
>
|
2023-10-28 11:15:42 -04:00
|
|
|
Log in
|
2023-10-28 10:45:47 -04:00
|
|
|
</button>
|
2023-10-28 11:15:42 -04:00
|
|
|
</a>
|
|
|
|
}
|
|
|
|
</li>
|
|
|
|
}
|
|
|
|
|
2023-10-29 19:10:32 -04:00
|
|
|
templ Nav(user *models.User) {
|
2023-10-28 11:15:42 -04:00
|
|
|
<nav class="top-0 absolute z-50 w-full flex flex-wrap items-center justify-between px-2 py-3 ">
|
|
|
|
<div class="container px-4 mx-auto flex flex-wrap items-center justify-between">
|
|
|
|
<div class="w-full relative flex justify-between lg:w-auto lg:static lg:block lg:justify-start">
|
|
|
|
@navTitle("Capstone")
|
2023-10-28 10:45:47 -04:00
|
|
|
</div>
|
|
|
|
<div
|
|
|
|
class="lg:flex flex-grow items-center bg-white lg:bg-transparent lg:shadow-none hidden"
|
|
|
|
id="example-collapse-navbar"
|
|
|
|
>
|
|
|
|
<ul class="flex flex-col lg:flex-row list-none mr-auto">
|
2023-10-28 11:15:42 -04:00
|
|
|
@navItem("About Us", "/about-us")
|
|
|
|
@navItem("Pricing", "/pricing")
|
2023-10-28 10:45:47 -04:00
|
|
|
</ul>
|
|
|
|
<ul class="flex flex-col lg:flex-row list-none lg:ml-auto">
|
2023-10-29 19:10:32 -04:00
|
|
|
if user != nil {
|
|
|
|
@navActionItem(true)
|
|
|
|
} else {
|
|
|
|
@navActionItem(false)
|
|
|
|
}
|
2023-10-28 10:45:47 -04:00
|
|
|
</ul>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</nav>
|
|
|
|
}
|