mirror of
https://github.com/jcreek/SvelteKitSaasBoilerplate.git
synced 2026-07-13 02:53:50 +00:00
feat(#29): Restyle navbar
This commit is contained in:
@@ -8,7 +8,7 @@
|
|||||||
<div tabindex="0" role="button" class="">Parent</div>
|
<div tabindex="0" role="button" class="">Parent</div>
|
||||||
{:else}
|
{:else}
|
||||||
<details>
|
<details>
|
||||||
<summary>Parent</summary>
|
<summary class="flex items-center"><span class="mr-1">▼</span>Parent </summary>
|
||||||
</details>
|
</details>
|
||||||
{/if}
|
{/if}
|
||||||
<ul
|
<ul
|
||||||
|
|||||||
+102
-83
@@ -47,6 +47,12 @@
|
|||||||
|
|
||||||
return () => data.subscription.unsubscribe();
|
return () => data.subscription.unsubscribe();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
let isMobileMenuOpen = false;
|
||||||
|
|
||||||
|
function toggleMobileMenu() {
|
||||||
|
isMobileMenuOpen = !isMobileMenuOpen;
|
||||||
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<svelte:head>
|
<svelte:head>
|
||||||
@@ -63,94 +69,107 @@
|
|||||||
</svelte:head>
|
</svelte:head>
|
||||||
|
|
||||||
<header>
|
<header>
|
||||||
<nav class="navbar bg-primary text-primary-content">
|
<nav class="bg-primary text-primary-content p-4">
|
||||||
<div class="navbar-start">
|
<div class="container mx-auto flex justify-between items-center">
|
||||||
<div class="dropdown">
|
<a href="/" class="text-white font-bold text-xl">SvelteKit SaaS Boilerplate</a>
|
||||||
<div tabindex="0" role="button" class="btn btn-ghost lg:hidden">
|
|
||||||
<svg
|
<!-- Hamburger Menu Button (Mobile) -->
|
||||||
xmlns="http://www.w3.org/2000/svg"
|
<button on:click={toggleMobileMenu} class="block md:hidden text-white focus:outline-none">
|
||||||
class="h-5 w-5"
|
<svg
|
||||||
fill="none"
|
class="w-6 h-6"
|
||||||
viewBox="0 0 24 24"
|
fill="none"
|
||||||
stroke="currentColor"
|
stroke="currentColor"
|
||||||
><path
|
viewBox="0 0 24 24"
|
||||||
stroke-linecap="round"
|
xmlns="http://www.w3.org/2000/svg"
|
||||||
stroke-linejoin="round"
|
|
||||||
stroke-width="2"
|
|
||||||
d="M4 6h16M4 12h8m-8 6h16"
|
|
||||||
/></svg
|
|
||||||
>
|
|
||||||
</div>
|
|
||||||
<ul
|
|
||||||
class="menu menu-sm dropdown-content mt-3 z-[1] p-2 shadow bg-base-100 text-base-content rounded-box w-52"
|
|
||||||
>
|
>
|
||||||
<NavLinks isMobile={true} />
|
<path
|
||||||
|
stroke-linecap="round"
|
||||||
|
stroke-linejoin="round"
|
||||||
|
stroke-width="2"
|
||||||
|
d="M4 6h16M4 12h8m-8 6h16"
|
||||||
|
></path>
|
||||||
|
</svg>
|
||||||
|
</button>
|
||||||
|
|
||||||
|
<!-- Navbar Links (hidden on mobile, visible on larger screens) -->
|
||||||
|
<div class="hidden md:flex space-x-4">
|
||||||
|
<ul class="flex flex-col md:flex-row md:space-x-4">
|
||||||
|
<NavLinks isMobile={false} />
|
||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
<a href="/" class="btn btn-ghost text-xl">SvelteKit SaaS Boilerplate</a>
|
|
||||||
</div>
|
|
||||||
<div class="navbar-center hidden lg:flex">
|
|
||||||
<ul class="menu menu-horizontal px-1">
|
|
||||||
<NavLinks isMobile={false} />
|
|
||||||
</ul>
|
|
||||||
</div>
|
|
||||||
<div class="navbar-end">
|
|
||||||
<a href="/checkout" class="btn btn-ghost btn-circle">
|
|
||||||
<div class="indicator">
|
|
||||||
<svg
|
|
||||||
xmlns="http://www.w3.org/2000/svg"
|
|
||||||
class="h-5 w-5"
|
|
||||||
fill="none"
|
|
||||||
viewBox="0 0 24 24"
|
|
||||||
stroke="currentColor"
|
|
||||||
><path
|
|
||||||
stroke-linecap="round"
|
|
||||||
stroke-linejoin="round"
|
|
||||||
stroke-width="2"
|
|
||||||
d="M3 3h2l.4 2M7 13h10l4-8H5.4M7 13L5.4 5M7 13l-2.293 2.293c-.63.63-.184 1.707.707 1.707H17m0 0a2 2 0 100 4 2 2 0 000-4zm-8 2a2 2 0 11-4 0 2 2 0 014 0z"
|
|
||||||
/></svg
|
|
||||||
>
|
|
||||||
<span class="badge badge-sm indicator-item">{localBasket.items.length}</span>
|
|
||||||
</div>
|
|
||||||
</a>
|
|
||||||
<details class="dropdown dropdown-end">
|
|
||||||
<summary tabindex="0" role="button" class="btn btn-ghost btn-circle avatar">
|
|
||||||
<div class="w-10 rounded-full">
|
|
||||||
{#if session?.user}
|
|
||||||
<div class="user-circle text-primary-content border-primary-content">
|
|
||||||
{session?.user.email[0].toUpperCase()}
|
|
||||||
</div>
|
|
||||||
{:else}
|
|
||||||
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="currentColor">
|
|
||||||
<path
|
|
||||||
fill-rule="evenodd"
|
|
||||||
d="M18.685 19.097A9.723 9.723 0 0 0 21.75 12c0-5.385-4.365-9.75-9.75-9.75S2.25 6.615 2.25 12a9.723 9.723 0 0 0 3.065 7.097A9.716 9.716 0 0 0 12 21.75a9.716 9.716 0 0 0 6.685-2.653Zm-12.54-1.285A7.486 7.486 0 0 1 12 15a7.486 7.486 0 0 1 5.855 2.812A8.224 8.224 0 0 1 12 20.25a8.224 8.224 0 0 1-5.855-2.438ZM15.75 9a3.75 3.75 0 1 1-7.5 0 3.75 3.75 0 0 1 7.5 0Z"
|
|
||||||
clip-rule="evenodd"
|
|
||||||
/>
|
|
||||||
</svg>
|
|
||||||
{/if}
|
|
||||||
</div>
|
|
||||||
</summary>
|
|
||||||
|
|
||||||
{#if session?.user}
|
<!-- Right Side: Basket & User Account -->
|
||||||
<ul
|
<div class="flex items-center space-x-4">
|
||||||
tabindex="-1"
|
<!-- Basket/Checkout Icon -->
|
||||||
class="mt-3 z-[1] p-2 shadow menu menu-sm dropdown-content bg-base-100 text-base-content rounded-box min-w-[13rem] w-auto"
|
<a href="/checkout" class="btn btn-ghost btn-circle">
|
||||||
>
|
<div class="indicator">
|
||||||
<li>
|
<svg
|
||||||
<a href="/account"> Account </a>
|
xmlns="http://www.w3.org/2000/svg"
|
||||||
</li>
|
class="h-5 w-5"
|
||||||
<li><a href="/settings">Settings</a></li>
|
fill="none"
|
||||||
<li><SignOut {supabase} /></li>
|
viewBox="0 0 24 24"
|
||||||
</ul>
|
stroke="currentColor"
|
||||||
{:else}
|
>
|
||||||
<div
|
<path
|
||||||
class="mt-3 z-[1] p-2 shadow menu menu-sm dropdown-content bg-base-100 text-base-content rounded-box min-w-[13rem] w-auto"
|
stroke-linecap="round"
|
||||||
>
|
stroke-linejoin="round"
|
||||||
<MagicLink {supabase} />
|
stroke-width="2"
|
||||||
|
d="M3 3h2l.4 2M7 13h10l4-8H5.4M7 13L5.4 5M7 13l-2.293 2.293c-.63.63-.184 1.707.707 1.707H17m0 0a2 2 0 100 4 2 2 0 000-4zm-8 2a2 2 0 11-4 0 2 2 0 014 0z"
|
||||||
|
/>
|
||||||
|
</svg>
|
||||||
|
<span class="badge badge-sm indicator-item">{localBasket.items.length}</span>
|
||||||
</div>
|
</div>
|
||||||
{/if}
|
</a>
|
||||||
</details>
|
|
||||||
|
<!-- User Account Dropdown -->
|
||||||
|
<details class="dropdown dropdown-end">
|
||||||
|
<summary tabindex="0" role="button" class="btn btn-ghost btn-circle avatar">
|
||||||
|
<div class="w-10 rounded-full">
|
||||||
|
{#if session?.user}
|
||||||
|
<div class="user-circle text-primary-content border-primary-content">
|
||||||
|
{session?.user.email[0].toUpperCase()}
|
||||||
|
</div>
|
||||||
|
{:else}
|
||||||
|
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="currentColor">
|
||||||
|
<path
|
||||||
|
fill-rule="evenodd"
|
||||||
|
d="M18.685 19.097A9.723 9.723 0 0 0 21.75 12c0-5.385-4.365-9.75-9.75-9.75S2.25 6.615 2.25 12a9.723 9.723 0 0 0 3.065 7.097A9.716 9.716 0 0 0 12 21.75a9.716 9.716 0 0 0 6.685-2.653Zm-12.54-1.285A7.486 7.486 0 0 1 12 15a7.486 7.486 0 0 1 5.855 2.812A8.224 8.224 0 0 1 12 20.25a8.224 8.224 0 0 1-5.855-2.438ZM15.75 9a3.75 3.75 0 1 1-7.5 0 3.75 3.75 0 0 1 7.5 0Z"
|
||||||
|
clip-rule="evenodd"
|
||||||
|
/>
|
||||||
|
</svg>
|
||||||
|
{/if}
|
||||||
|
</div>
|
||||||
|
</summary>
|
||||||
|
|
||||||
|
{#if session?.user}
|
||||||
|
<ul
|
||||||
|
tabindex="-1"
|
||||||
|
class="mt-3 z-[1] p-2 shadow menu menu-sm dropdown-content bg-base-100 text-base-content rounded-box min-w-[13rem] w-auto"
|
||||||
|
>
|
||||||
|
<li><a href="/account">Account</a></li>
|
||||||
|
<li><a href="/settings">Settings</a></li>
|
||||||
|
<li><SignOut {supabase} /></li>
|
||||||
|
</ul>
|
||||||
|
{:else}
|
||||||
|
<div
|
||||||
|
class="mt-3 z-[1] p-2 shadow menu menu-sm dropdown-content bg-base-100 text-base-content rounded-box min-w-[13rem] w-auto"
|
||||||
|
>
|
||||||
|
<MagicLink {supabase} />
|
||||||
|
</div>
|
||||||
|
{/if}
|
||||||
|
</details>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!-- Mobile Menu -->
|
||||||
|
<div
|
||||||
|
class="bg-base-100 text-base-content shadow rounded-box p-4 transition duration-300 ease-in-out md:hidden"
|
||||||
|
class:block={isMobileMenuOpen}
|
||||||
|
class:hidden={!isMobileMenuOpen}
|
||||||
|
>
|
||||||
|
<ul class="flex flex-col space-y-4">
|
||||||
|
<NavLinks isMobile={true} />
|
||||||
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
</nav>
|
</nav>
|
||||||
</header>
|
</header>
|
||||||
|
|||||||
Reference in New Issue
Block a user