From 817359473cd02bd777b7488845dc67e91d5d10d9 Mon Sep 17 00:00:00 2001 From: Benjamin Palko Date: Thu, 2 Jan 2025 22:35:54 -0500 Subject: [PATCH] fill out button props to match what is available on daisy --- .../components/Actions/Button.stories.svelte | 19 ++++---- src/lib/components/Actions/Button.svelte | 47 ++++++++++++------- src/lib/components/Feedback/index.ts | 2 +- src/lib/types/daisy-colors.ts | 2 - src/routes/+page.svelte | 2 +- 5 files changed, 41 insertions(+), 31 deletions(-) diff --git a/src/lib/components/Actions/Button.stories.svelte b/src/lib/components/Actions/Button.stories.svelte index abd7504..4d8be63 100644 --- a/src/lib/components/Actions/Button.stories.svelte +++ b/src/lib/components/Actions/Button.stories.svelte @@ -8,9 +8,11 @@ title: 'Actions/Button', component: Button, args: { - onClick: fn(), + onclick: fn(), }, argTypes: { + active: { control: 'boolean' }, + animation: { control: 'boolean' }, block: { control: 'boolean' }, color: { control: 'select', @@ -20,28 +22,25 @@ 'secondary', 'accent', 'ghost', - 'link', 'info', 'success', 'warning', 'error', ], }, + disabled: { control: 'boolean' }, full: { control: 'boolean' }, glass: { control: 'boolean' }, - outline: { - control: 'boolean', + shape: { + control: 'select', + options: ['circle', 'square'], }, - responsive: { control: 'boolean' }, size: { control: 'select', - options: ['Default', 'xs', 'sm', 'lg'], + options: ['xs', 'sm', '-', 'lg'], defaultValue: 'Default', }, - type: { - control: 'select', - options: ['button', 'reset', 'submit'], - }, + variant: { control: 'select', options: ['link', 'outline'] }, wide: { control: 'boolean' }, }, }); diff --git a/src/lib/components/Actions/Button.svelte b/src/lib/components/Actions/Button.svelte index f550841..43e89a3 100644 --- a/src/lib/components/Actions/Button.svelte +++ b/src/lib/components/Actions/Button.svelte @@ -3,57 +3,70 @@ import type { Snippet } from 'svelte'; import type { HTMLButtonAttributes } from 'svelte/elements'; - interface Props { + interface Props extends HTMLButtonAttributes { + active?: boolean; + animation?: boolean; block?: boolean; children: Snippet; color?: DaisyColor; + disabled?: boolean; full?: boolean; glass?: boolean; - outline?: boolean; - onClick?: () => void; - responsive?: boolean; + onclick?: () => void; + shape?: 'circle' | 'square'; size?: DaisySize; type?: HTMLButtonAttributes['type']; + variant?: 'link' | 'outline'; wide?: boolean; } let { + active = false, + animation = true, block = false, children, color, + disabled = false, full = false, glass = false, - outline = false, - onClick, - responsive = false, + onclick: onClick, + shape, size, type = 'button', wide = false, + variant, + ...props }: Props = $props(); diff --git a/src/lib/components/Feedback/index.ts b/src/lib/components/Feedback/index.ts index 336b5ed..85096d3 100644 --- a/src/lib/components/Feedback/index.ts +++ b/src/lib/components/Feedback/index.ts @@ -1 +1 @@ -export { default as Loader } from './Loader.svelte'; \ No newline at end of file +export { default as Loader } from './Loader.svelte'; diff --git a/src/lib/types/daisy-colors.ts b/src/lib/types/daisy-colors.ts index e8c5062..9947e01 100644 --- a/src/lib/types/daisy-colors.ts +++ b/src/lib/types/daisy-colors.ts @@ -1,11 +1,9 @@ export type DaisyColor = - | 'default' | 'neutral' | 'primary' | 'secondary' | 'accent' | 'ghost' - | 'link' | 'info' | 'success' | 'warning' diff --git a/src/routes/+page.svelte b/src/routes/+page.svelte index 5c20636..9ae838e 100644 --- a/src/routes/+page.svelte +++ b/src/routes/+page.svelte @@ -19,4 +19,4 @@ .site-loader { @apply flex h-screen w-screen flex-col items-center justify-center gap-6; } - \ No newline at end of file +