Extend shared UI component customization
Lint / Lint (Node/Svelte) (push) Successful in 23s
Lint / Lint (Go) (push) Successful in 16s
Lint / Lint (Python) (push) Successful in 9s
Tests / Test (Node/Svelte) (push) Successful in 14s
Tests / Test (Go) (push) Successful in 17s
Tests / Test (Python) (push) Successful in 9s
Lint / Lint (Node/Svelte) (push) Successful in 23s
Lint / Lint (Go) (push) Successful in 16s
Lint / Lint (Python) (push) Successful in 9s
Tests / Test (Node/Svelte) (push) Successful in 14s
Tests / Test (Go) (push) Successful in 17s
Tests / Test (Python) (push) Successful in 9s
This commit is contained in:
1 parent
c95865dbe2
commit
2f57554154
6 files changed
+41
-3
No files matched your search
@@ -1,4 +1,5 @@
|
||||
<script lang="ts">
|
||||
import type { Snippet } from 'svelte';
|
||||
import type { NavItem } from '../types';
|
||||
|
||||
let {
|
||||
@@ -6,7 +7,9 @@
|
||||
brandHref = '/',
|
||||
currentPath = '',
|
||||
navItems = [],
|
||||
actions,
|
||||
onLogout,
|
||||
onNavigate,
|
||||
onProfile,
|
||||
onSettings,
|
||||
showSettings = true,
|
||||
@@ -16,7 +19,9 @@
|
||||
brandHref?: string;
|
||||
currentPath?: string;
|
||||
navItems?: NavItem[];
|
||||
actions?: Snippet;
|
||||
onLogout?: () => void | Promise<void>;
|
||||
onNavigate?: (item: NavItem) => void;
|
||||
onProfile?: () => void;
|
||||
onSettings?: () => void;
|
||||
showSettings?: boolean;
|
||||
@@ -45,7 +50,13 @@
|
||||
class="sc-nav-link"
|
||||
data-active={isActive(item)}
|
||||
href={item.href}
|
||||
onclick={() => (navOpen = false)}
|
||||
onclick={(event) => {
|
||||
if (onNavigate) {
|
||||
event.preventDefault();
|
||||
onNavigate(item);
|
||||
}
|
||||
navOpen = false;
|
||||
}}
|
||||
>
|
||||
{item.label}
|
||||
</a>
|
||||
@@ -53,6 +64,8 @@
|
||||
</nav>
|
||||
|
||||
<div class="sc-header-actions">
|
||||
{#if actions}{@render actions()}{/if}
|
||||
|
||||
{#if showSettings && onSettings}
|
||||
<button aria-label="Open settings" class="sc-icon-button" type="button" onclick={onSettings}>⚙</button>
|
||||
{/if}
|
||||
|
||||
Reference in new issue
Block a user