cleanup: switch to a css-based navbar (#491)

* cleanup: remove dock options and make adaptive by default

* cleanup: switch to css-based navbar

* feat: add auto hide option
This commit is contained in:
Xylight authored and GitHub committed 2025-02-16 19:12:58 -08:00
1 parent b5ce17308a
commit 10f0ed208f
17 files changed
+110 -261

No files matched your search

+22 -20
View File
@@ -1,8 +1,7 @@
<script lang="ts">
import { page } from '$app/state'
import { Button } from 'mono-svelte'
import { Button, buttonColor } from 'mono-svelte'
import { Icon, type IconSource } from 'svelte-hero-icons'
import { dockProps } from '../layout/Shell.svelte'
import type { ButtonProps } from 'mono-svelte/button/Button.svelte'
interface Props extends ButtonProps {
@@ -19,8 +18,8 @@
let {
label,
icon = undefined,
href = undefined,
icon,
href,
adaptive = true,
isSelectedFilter = (path) => href != undefined && path == href,
class: clazz = '',
@@ -30,35 +29,38 @@
}: Props = $props()
let isSelected = $derived(isSelectedFilter(page.url.pathname))
let isPanel = $derived(adaptive ? $dockProps?.noGap : false)
</script>
<Button
color={isPanel ? 'secondary' : 'tertiary'}
color="none"
{...rest}
class="rounded-full w-10 h-10 flex-shrink-0 {adaptive
? '@3xl:h-8 @3xl:px-3 @3xl:rounded-[10px] @3xl:w-auto'
: ''} {isSelected
? 'bg-slate-200 dark:bg-zinc-900 text-primary-900 dark:!text-primary-100'
: ''} {clazz}"
class={[
'flex-shrink-0 rounded-full w-10 h-10 lg:w-max lg:h-8 lg:px-3 lg:rounded-xl',
isSelected &&
'bg-slate-200 dark:bg-zinc-900 text-primary-900 dark:!text-primary-100',
!rest.color && buttonColor.tertiary,
!rest.color &&
'lg:bg-white lg:dark:bg-zinc-900 border lg:border-slate-200 lg:border-b-slate-300 lg:dark:border-zinc-800 lg:dark:border-t-zinc-700/50 lg:hover:bg-slate-100 lg:hover:dark:bg-zinc-800 lg:active:bg-slate-200 lg:active:dark:bg-zinc-950',
clazz,
]}
size="custom"
rounding="none"
{href}
rounding="pill"
title={label}
style="transition-property: background-color, filter;"
>
{#snippet prefix()}
{#if icon}
<Icon
src={icon}
micro={isPanel}
solid={!isPanel && isSelected}
size={isPanel ? '16' : '18'}
/>
<div class="lg:hidden">
<Icon src={icon} size="18" />
</div>
<div class="max-lg:hidden">
<Icon src={icon} micro solid={isSelected} size="16" />
</div>
{:else}
{@render customIcon?.({ size: isPanel ? 16 : 18, isSelected })}
{@render customIcon?.({ size: 16, isSelected })}
{/if}
{/snippet}
<span class="hidden {adaptive ? '@3xl:block' : ''}">{label}</span>
<span class="hidden {adaptive ? 'lg:block' : ''}">{label}</span>
{@render children?.()}
</Button>
+1 -1
View File
@@ -50,7 +50,7 @@
}}
href="/"
label={$t('nav.home')}
class="ml-2 logo"
class="ml-2 lg:ml-2 logo border-0 lg:rounded-full lg:w-10 lg:h-10 lg:!p-0"
adaptive={false}
>
{#snippet customIcon()}