ui, server handling improvements
This commit is contained in:
@@ -6,20 +6,20 @@
|
||||
const { data, children } = $props();
|
||||
const { user } = data;
|
||||
|
||||
function getNavClass(path: string) {
|
||||
function getNavClass(path: RegExp) {
|
||||
return cn('hover:text-foreground/80 transition-colors',
|
||||
$page.url.pathname.startsWith(path) ? 'text-foreground' : 'text-foreground/60');
|
||||
path.test($page.url.pathname) ? 'text-foreground' : 'text-foreground/60');
|
||||
}
|
||||
</script>
|
||||
|
||||
<header class="p-4 sm:flex">
|
||||
<span class=" mr-6 font-bold sm:inline-block">VPGen</span>
|
||||
<nav class="flex items-center gap-6 text-sm">
|
||||
<a href="/" class={getNavClass("/")}>Home</a>
|
||||
<a href="/" class={getNavClass(/^\/$/)}>Home</a>
|
||||
{#if user}
|
||||
<a href="/user" class={getNavClass("/user")}>Profile</a>
|
||||
<a href="/connections" class={getNavClass("/connections")}>Connections</a>
|
||||
<a href="/clients" class={getNavClass("/clients")}>Clients</a>
|
||||
<a href="/user" class={getNavClass(/^\/user$/)}>Profile</a>
|
||||
<a href="/connections" class={getNavClass(/^\/connections$/)}>Connections</a>
|
||||
<a href="/clients" class={getNavClass(/^\/clients(\/\d+)?$/)}>Clients</a>
|
||||
{/if}
|
||||
</nav>
|
||||
</header>
|
||||
|
Reference in New Issue
Block a user