Skip to content

Commit

Permalink
Simplify bottom nav
Browse files Browse the repository at this point in the history
  • Loading branch information
leomorpho committed Sep 28, 2024
1 parent 65403a5 commit e02f5b3
Show file tree
Hide file tree
Showing 4 changed files with 29 additions and 116 deletions.
64 changes: 5 additions & 59 deletions templates/components/bottom_nav.templ
Original file line number Diff line number Diff line change
Expand Up @@ -14,21 +14,9 @@ templ BottomNav(page *controller.Page) {
style="padding-bottom: env(safe-area-inset-bottom);"
>
<div
class={
"grid h-full max-w-lg mx-auto font-medium grid-cols-4",
// templ.KV("grid-cols-3", page.ExperienceType == domain.ExperienceTypeCommittedRelationship),
// templ.KV("grid-cols-4", page.ExperienceType == domain.ExperienceTypeDating),
}
hx-target="#main-content"
hx-select="#main-content"
hx-indicator="next #page-loading"
hx-swap="outerHTML show:window:top"
hx-push-url="true"
class={ "grid h-full max-w-lg mx-auto font-medium grid-cols-4", }
x-cloak
x-data="{ selected: null }"
if page.SelectedBottomNavbarItem.Value == "meet" {
x-data="{ selected: 'meet' }"
}
if page.SelectedBottomNavbarItem.Value == "home" {
x-data="{ selected: 'home' }"
}
Expand All @@ -41,51 +29,17 @@ templ BottomNav(page *controller.Page) {
if page.SelectedBottomNavbarItem.Value == "profile" {
x-data="{ selected: 'profile' }"
}
hx-target="#bottomNavbarContent"
hx-select="#bottomNavbarContent"
hx-swap="outerHTML show:window:top"
>
// if page.ExperienceType == domain.ExperienceTypeDating {
// // Meet button
// <button
// hx-get={ page.ToURL("meet.get_match") }
// type="button"
// class="inline-flex flex-col items-center justify-center px-5 hover:bg-gray-100 dark:hover:bg-gray-800 group rounded-xl m-2"
// @click="selected = 'meet';"
// >
// <svg
// xmlns="http://www.w3.org/2000/svg"
// viewBox="0 0 20 20"
// fill="currentColor"
// class="w-7 h-7 group-hover:text-blue-600 dark:group-hover:text-blue-500"
// :class="{'text-blue-500 dark:text-blue-400': selected === 'meet', 'text-gray-500 dark:text-gray-400': selected !== 'meet'}"
// >
// <path fill-rule="evenodd" d="M13.5 4.938a7 7 0 1 1-9.006 1.737c.202-.257.59-.218.793.039.278.352.594.672.943.954.332.269.786-.049.773-.476a5.977 5.977 0 0 1 .572-2.759 6.026 6.026 0 0 1 2.486-2.665c.247-.14.55-.016.677.238A6.967 6.967 0 0 0 13.5 4.938ZM14 12a4 4 0 0 1-4 4c-1.913 0-3.52-1.398-3.91-3.182-.093-.429.44-.643.814-.413a4.043 4.043 0 0 0 1.601.564c.303.038.531-.24.51-.544a5.975 5.975 0 0 1 1.315-4.192.447.447 0 0 1 .431-.16A4.001 4.001 0 0 1 14 12Z" clip-rule="evenodd"></path>
// </svg>
// </button>
// }
// Home button
<button
id="bottom-navbar-homefeed-button"
id="bottomNavbarHomefeedButton"
hx-get={ page.ToURL("home_feed") }
hx-target="#bottomNavbarContent"
hx-select="#bottomNavbarContent"
hx-on="htmx:afterRequest:handleCacheUpdate"
type="button"
class="inline-flex flex-col items-center justify-center px-5 hover:bg-gray-100 dark:hover:bg-gray-800 group rounded-xl m-2"
@click="selected = 'home';"
>
// <div class="relative">
// <img
// src="/files/favicon.png"
// class="w-7 h-7 group-hover:text-blue-600 dark:group-hover:text-blue-500"
// :class="{'hidden': selected === 'home', 'block grayscale dark:grayscale-50': selected !== 'home'}"
// alt="Logo"
// />
// <img
// src="/files/favicon.png"
// class="w-7 h-7 group-hover:text-blue-600 dark:group-hover:text-blue-500"
// :class="{'block text-blue-500 dark:text-blue-400': selected === 'home', 'hidden': selected !== 'home'}"
// alt="Logo"
// />
// </div>
<svg
xmlns="http://www.w3.org/2000/svg"
width="24"
Expand Down Expand Up @@ -113,8 +67,6 @@ templ BottomNav(page *controller.Page) {
<button
id="bottom-navbar-notifications-button"
hx-get={ page.ToURL("normalNotifications") }
hx-target="#bottomNavbarContent"
hx-select="#bottomNavbarContent"
type="button"
class="inline-flex flex-col items-center justify-center px-5 hover:bg-gray-100 dark:hover:bg-gray-800 group rounded-xl m-2"
@click="selected = 'notifications';"
Expand Down Expand Up @@ -162,9 +114,6 @@ templ BottomNav(page *controller.Page) {
<button
id="bottom-navbar-settings-button"
hx-get={ page.ToURL("preferences") }
hx-target="#bottomNavbarContent"
hx-select="#bottomNavbarContent"
hx-on="htmx:afterRequest:handleCacheUpdate"
type="button"
class="inline-flex flex-col items-center justify-center px-5 hover:bg-gray-100 dark:hover:bg-gray-800 group rounded-xl m-2"
@click="selected = 'settings';"
Expand Down Expand Up @@ -196,9 +145,6 @@ templ BottomNav(page *controller.Page) {
<button
id="bottom-navbar-profile-button"
hx-get={ page.ToURL("profile") }
hx-target="#bottomNavbarContent"
hx-select="#bottomNavbarContent"
hx-on="htmx:afterRequest:handleCacheUpdate"
type="button"
class="inline-flex flex-col items-center justify-center px-5 hover:bg-gray-100 dark:hover:bg-gray-800 group rounded-xl m-2"
@click="selected = 'profile';"
Expand Down
Loading

0 comments on commit e02f5b3

Please sign in to comment.