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
@@ -9,8 +9,10 @@
|
|||||||
children,
|
children,
|
||||||
class: className = '',
|
class: className = '',
|
||||||
currentPath = '',
|
currentPath = '',
|
||||||
|
headerActions,
|
||||||
navItems = [],
|
navItems = [],
|
||||||
onLogout,
|
onLogout,
|
||||||
|
onNavigate,
|
||||||
onProfile,
|
onProfile,
|
||||||
onSettings,
|
onSettings,
|
||||||
showSettings = true,
|
showSettings = true,
|
||||||
@@ -22,8 +24,10 @@
|
|||||||
children?: Snippet;
|
children?: Snippet;
|
||||||
class?: string;
|
class?: string;
|
||||||
currentPath?: string;
|
currentPath?: string;
|
||||||
|
headerActions?: Snippet;
|
||||||
navItems?: NavItem[];
|
navItems?: NavItem[];
|
||||||
onLogout?: () => void | Promise<void>;
|
onLogout?: () => void | Promise<void>;
|
||||||
|
onNavigate?: (item: NavItem) => void;
|
||||||
onProfile?: () => void;
|
onProfile?: () => void;
|
||||||
onSettings?: () => void;
|
onSettings?: () => void;
|
||||||
showSettings?: boolean;
|
showSettings?: boolean;
|
||||||
@@ -37,8 +41,10 @@
|
|||||||
{brand}
|
{brand}
|
||||||
{brandHref}
|
{brandHref}
|
||||||
{currentPath}
|
{currentPath}
|
||||||
|
actions={headerActions}
|
||||||
{navItems}
|
{navItems}
|
||||||
{onLogout}
|
{onLogout}
|
||||||
|
{onNavigate}
|
||||||
{onProfile}
|
{onProfile}
|
||||||
{onSettings}
|
{onSettings}
|
||||||
{showSettings}
|
{showSettings}
|
||||||
|
|||||||
@@ -1,9 +1,11 @@
|
|||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
|
import type { Snippet } from 'svelte';
|
||||||
import type { AuthLoginInput, AuthSetupInput } from '../types';
|
import type { AuthLoginInput, AuthSetupInput } from '../types';
|
||||||
import Button from './Button.svelte';
|
import Button from './Button.svelte';
|
||||||
|
|
||||||
let {
|
let {
|
||||||
brand = 'Application',
|
brand = 'Application',
|
||||||
|
children,
|
||||||
error = '',
|
error = '',
|
||||||
loading = false,
|
loading = false,
|
||||||
onLogin,
|
onLogin,
|
||||||
@@ -12,6 +14,7 @@
|
|||||||
tagline = ''
|
tagline = ''
|
||||||
}: {
|
}: {
|
||||||
brand?: string;
|
brand?: string;
|
||||||
|
children?: Snippet;
|
||||||
error?: string;
|
error?: string;
|
||||||
loading?: boolean;
|
loading?: boolean;
|
||||||
onLogin?: (input: AuthLoginInput) => void | Promise<void>;
|
onLogin?: (input: AuthLoginInput) => void | Promise<void>;
|
||||||
@@ -142,5 +145,9 @@
|
|||||||
{loading || submitting ? 'Please wait…' : setupRequired ? 'Create account' : 'Log in'}
|
{loading || submitting ? 'Please wait…' : setupRequired ? 'Create account' : 'Log in'}
|
||||||
</Button>
|
</Button>
|
||||||
</form>
|
</form>
|
||||||
|
|
||||||
|
{#if children}
|
||||||
|
<div class="sc-auth-extra">{@render children()}</div>
|
||||||
|
{/if}
|
||||||
</section>
|
</section>
|
||||||
</div>
|
</div>
|
||||||
@@ -1,4 +1,5 @@
|
|||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
|
import type { Snippet } from 'svelte';
|
||||||
import type { NavItem } from '../types';
|
import type { NavItem } from '../types';
|
||||||
|
|
||||||
let {
|
let {
|
||||||
@@ -6,7 +7,9 @@
|
|||||||
brandHref = '/',
|
brandHref = '/',
|
||||||
currentPath = '',
|
currentPath = '',
|
||||||
navItems = [],
|
navItems = [],
|
||||||
|
actions,
|
||||||
onLogout,
|
onLogout,
|
||||||
|
onNavigate,
|
||||||
onProfile,
|
onProfile,
|
||||||
onSettings,
|
onSettings,
|
||||||
showSettings = true,
|
showSettings = true,
|
||||||
@@ -16,7 +19,9 @@
|
|||||||
brandHref?: string;
|
brandHref?: string;
|
||||||
currentPath?: string;
|
currentPath?: string;
|
||||||
navItems?: NavItem[];
|
navItems?: NavItem[];
|
||||||
|
actions?: Snippet;
|
||||||
onLogout?: () => void | Promise<void>;
|
onLogout?: () => void | Promise<void>;
|
||||||
|
onNavigate?: (item: NavItem) => void;
|
||||||
onProfile?: () => void;
|
onProfile?: () => void;
|
||||||
onSettings?: () => void;
|
onSettings?: () => void;
|
||||||
showSettings?: boolean;
|
showSettings?: boolean;
|
||||||
@@ -45,7 +50,13 @@
|
|||||||
class="sc-nav-link"
|
class="sc-nav-link"
|
||||||
data-active={isActive(item)}
|
data-active={isActive(item)}
|
||||||
href={item.href}
|
href={item.href}
|
||||||
onclick={() => (navOpen = false)}
|
onclick={(event) => {
|
||||||
|
if (onNavigate) {
|
||||||
|
event.preventDefault();
|
||||||
|
onNavigate(item);
|
||||||
|
}
|
||||||
|
navOpen = false;
|
||||||
|
}}
|
||||||
>
|
>
|
||||||
{item.label}
|
{item.label}
|
||||||
</a>
|
</a>
|
||||||
@@ -53,6 +64,8 @@
|
|||||||
</nav>
|
</nav>
|
||||||
|
|
||||||
<div class="sc-header-actions">
|
<div class="sc-header-actions">
|
||||||
|
{#if actions}{@render actions()}{/if}
|
||||||
|
|
||||||
{#if showSettings && onSettings}
|
{#if showSettings && onSettings}
|
||||||
<button aria-label="Open settings" class="sc-icon-button" type="button" onclick={onSettings}>⚙</button>
|
<button aria-label="Open settings" class="sc-icon-button" type="button" onclick={onSettings}>⚙</button>
|
||||||
{/if}
|
{/if}
|
||||||
|
|||||||
@@ -5,20 +5,24 @@
|
|||||||
actions,
|
actions,
|
||||||
children,
|
children,
|
||||||
description = '',
|
description = '',
|
||||||
|
subtitle = '',
|
||||||
title
|
title
|
||||||
}: {
|
}: {
|
||||||
actions?: Snippet;
|
actions?: Snippet;
|
||||||
children?: Snippet;
|
children?: Snippet;
|
||||||
description?: string;
|
description?: string;
|
||||||
|
subtitle?: string;
|
||||||
title: string;
|
title: string;
|
||||||
} = $props();
|
} = $props();
|
||||||
|
|
||||||
|
const supportingText = $derived(description || subtitle);
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<div class="sc-page-header">
|
<div class="sc-page-header">
|
||||||
<div>
|
<div>
|
||||||
<h1>{title}</h1>
|
<h1>{title}</h1>
|
||||||
{#if description}
|
{#if supportingText}
|
||||||
<p>{description}</p>
|
<p>{supportingText}</p>
|
||||||
{/if}
|
{/if}
|
||||||
{@render children?.()}
|
{@render children?.()}
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -419,6 +419,10 @@
|
|||||||
margin-top: 1.5rem;
|
margin-top: 1.5rem;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.sc-auth-extra {
|
||||||
|
margin-top: 1rem;
|
||||||
|
}
|
||||||
|
|
||||||
.sc-dialog-backdrop {
|
.sc-dialog-backdrop {
|
||||||
position: fixed;
|
position: fixed;
|
||||||
z-index: 100;
|
z-index: 100;
|
||||||
|
|||||||
@@ -419,6 +419,10 @@
|
|||||||
margin-top: 1.5rem;
|
margin-top: 1.5rem;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.sc-auth-extra {
|
||||||
|
margin-top: 1rem;
|
||||||
|
}
|
||||||
|
|
||||||
.sc-dialog-backdrop {
|
.sc-dialog-backdrop {
|
||||||
position: fixed;
|
position: fixed;
|
||||||
z-index: 100;
|
z-index: 100;
|
||||||
|
|||||||
Reference in new issue
Block a user