feat: add Storybook component explorer
This commit is contained in:
parent
f1dc95b51c
commit
d95f064189
47 changed files with 1730 additions and 8 deletions
80
src/lib/ui/components/Button.svelte
Normal file
80
src/lib/ui/components/Button.svelte
Normal file
|
|
@ -0,0 +1,80 @@
|
|||
<script lang="ts">
|
||||
import IconGlyph from "./IconGlyph.svelte";
|
||||
|
||||
let {
|
||||
label,
|
||||
variant = "primary",
|
||||
size = "default",
|
||||
icon,
|
||||
disabled = false,
|
||||
loading = false,
|
||||
type = "button",
|
||||
}: {
|
||||
label: string;
|
||||
variant?: "primary" | "secondary" | "danger" | "ghost";
|
||||
size?: "default" | "compact";
|
||||
icon?: string;
|
||||
disabled?: boolean;
|
||||
loading?: boolean;
|
||||
type?: "button" | "submit" | "reset";
|
||||
} = $props();
|
||||
</script>
|
||||
|
||||
<button
|
||||
class="ui-button"
|
||||
data-variant={variant}
|
||||
data-size={size}
|
||||
data-loading={loading}
|
||||
{disabled}
|
||||
{type}
|
||||
>
|
||||
{#if icon}
|
||||
<IconGlyph name={icon} size="sm" />
|
||||
{/if}
|
||||
<span>{loading ? "Loading" : label}</span>
|
||||
</button>
|
||||
|
||||
<style>
|
||||
.ui-button {
|
||||
display: inline-grid;
|
||||
grid-auto-flow: column;
|
||||
gap: var(--ui-space-2);
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
min-height: 2.5rem;
|
||||
border: var(--ui-border);
|
||||
background: var(--ui-color-accent);
|
||||
color: var(--ui-color-canvas);
|
||||
cursor: pointer;
|
||||
font-size: 0.76rem;
|
||||
font-weight: 850;
|
||||
letter-spacing: 0;
|
||||
padding: 0 var(--ui-space-4);
|
||||
text-transform: uppercase;
|
||||
}
|
||||
|
||||
.ui-button[data-size="compact"] {
|
||||
min-height: 2rem;
|
||||
padding-inline: var(--ui-space-3);
|
||||
}
|
||||
|
||||
.ui-button[data-variant="secondary"] {
|
||||
background: var(--ui-color-surface-raised);
|
||||
color: var(--ui-color-text);
|
||||
}
|
||||
|
||||
.ui-button[data-variant="danger"] {
|
||||
background: var(--ui-color-danger);
|
||||
color: var(--ui-color-text);
|
||||
}
|
||||
|
||||
.ui-button[data-variant="ghost"] {
|
||||
background: transparent;
|
||||
color: var(--ui-color-muted);
|
||||
}
|
||||
|
||||
.ui-button:disabled {
|
||||
cursor: not-allowed;
|
||||
opacity: 0.48;
|
||||
}
|
||||
</style>
|
||||
Loading…
Add table
Add a link
Reference in a new issue