Files
shared/packages/web-ui/src/lib/components/Button.svelte
T
Gabriel20xx 7b5a4e6c2c Merge media-webui/media-backend into the general shared component/backend system
Extracts a new backend/authproxy package for the AuthGuard-proxy helper
functions (session cookie handling, input normalization, error
translation) that Bitmagnet/GameStream/media-backend/AutoCode/
CollabTable/PubliSafe/SimpleCollection/SyncServer/UnraidMonitor/
OutdoorGames were each independently reimplementing, and repoints all
of them onto it.

Extends packages/web-ui's Button/Badge with the variants media-webui
needed (outline, icon size, primary badge) and promotes EmptyState/
SectionTitle/Metric/StatusWidget/StatusDialog into the shared library,
then migrates media-webui off its own diverged ui/{button,card,badge,
metric} components and local duplicates of the promoted components
onto @gabriel20xx/web-ui, so media-webui is a proper consumer of the
same design system every other project already uses instead of a
parallel fork.

Also removes the dead `desktop`/MediaDesktop service variant from
media-backend and media-webui (MediaDesktop is an Electron client that
never actually runs this stack).
2026-09-03 00:14:01 +02:00

39 lines
975 B
Svelte

<script lang="ts">
import type { HTMLButtonAttributes } from 'svelte/elements';
import type { Snippet } from 'svelte';
type ButtonVariant = 'primary' | 'secondary' | 'outline' | 'ghost' | 'danger';
type ButtonSize = 'sm' | 'md' | 'lg' | 'icon';
let {
children,
class: className = '',
disabled = false,
fullWidth = false,
onclick,
size = 'md',
type = 'button',
variant = 'primary',
...rest
}: Omit<HTMLButtonAttributes, 'class' | 'disabled' | 'onclick' | 'type'> & {
children?: Snippet;
class?: string;
disabled?: boolean;
fullWidth?: boolean;
onclick?: (event: MouseEvent) => void;
size?: ButtonSize;
type?: 'button' | 'submit' | 'reset';
variant?: ButtonVariant;
} = $props();
</script>
<button
class={`sc-button sc-button-${variant} sc-button-${size}${fullWidth ? ' sc-button-full' : ''} ${className}`}
{disabled}
{onclick}
{type}
{...rest}
>
{@render children?.()}
</button>