Add favicon support and loading state to authentication components

This commit is contained in:
Gabriel20xx committed 2026-08-10 10:42:40 +02:00
1 parent d0b18a4902
commit 81077527ac
4 files changed
+25 -21

No files matched your search

@@ -11,6 +11,7 @@
children,
class: className = '',
currentPath = '',
faviconHref = '/favicon.svg',
headerActions,
navItems = [],
onAbout,
@@ -29,6 +30,7 @@
children?: Snippet;
class?: string;
currentPath?: string;
faviconHref?: string;
headerActions?: Snippet;
navItems?: NavItem[];
onAbout?: () => void | Promise<void>;
@@ -51,10 +53,11 @@
<div class={`sc-root sc-app-shell ${className}`} data-theme={theme === 'system' ? undefined : theme}>
<Header
aboutHref={aboutHref ?? navItems.find((item) => item.label.toLowerCase() === 'about')?.href}
aboutHref={aboutHref ?? navItems.find((item) => item.label.toLowerCase() === 'about')?.href ?? '/about'}
{brand}
{brandHref}
{currentPath}
{faviconHref}
actions={headerActions}
{navItems}
{onAbout}
@@ -134,13 +134,18 @@
</script>
<div class="sc-root sc-auth-page">
<section aria-labelledby="sc-auth-title" class="sc-auth-card">
<section aria-busy={loading} aria-labelledby="sc-auth-title" class="sc-auth-card">
<div class="sc-auth-brand">
<img alt="" aria-hidden="true" class="sc-auth-brand-icon" src={faviconHref} />
<span>{brand}</span>
</div>
<h1 id="sc-auth-title">{setupRequired ? 'Create your account' : 'Welcome back'}</h1>
{#if loading}
<h1 id="sc-auth-title">Loading...</h1>
{:else}
<h1 id="sc-auth-title">{setupRequired ? 'Create your account' : 'Welcome back'}</h1>
{/if}
{#if !loading}
{#if tagline}
<p class="sc-auth-subtitle">{tagline}</p>
{/if}
@@ -268,5 +273,6 @@
</button>
{/if}
{/if}
{/if}
</section>
</div>
@@ -5,7 +5,6 @@
BarChart3,
Bot,
Box,
ChevronDown,
CircleAlert,
CircleHelp,
CircleUserRound,
@@ -93,11 +92,11 @@
};
let {
aboutHref,
aboutHref = '/about',
brand = 'Application',
brandHref = '/',
brandIcon,
currentPath = '',
faviconHref = '/favicon.svg',
navItems = [],
actions,
onAbout,
@@ -111,8 +110,8 @@
aboutHref?: string;
brand?: string;
brandHref?: string;
brandIcon?: Snippet;
currentPath?: string;
faviconHref?: string;
navItems?: NavItem[];
actions?: Snippet;
onAbout?: () => void | Promise<void>;
@@ -162,11 +161,7 @@
<header class="sc-header">
<a class="sc-brand" href={brandHref} onclick={closeMenus}>
<span aria-hidden="true" class="sc-brand-mark">
{#if brandIcon}
{@render brandIcon()}
{:else}
{brand.slice(0, 1).toUpperCase()}
{/if}
<img alt="" class="sc-brand-icon" src={faviconHref} />
</span>
<span>{brand}</span>
</a>
@@ -207,7 +202,6 @@
>
<CircleUserRound aria-hidden="true" class="sc-profile-icon" size={16} strokeWidth={2} />
<span>{username}</span>
<ChevronDown aria-hidden="true" class="sc-profile-chevron" size={15} strokeWidth={2} />
</button>
{#if profileOpen}