From d32d88b56c889f931b37b4d1d29007951d8a0f12 Mon Sep 17 00:00:00 2001 From: R2m1liA <15258427350@163.com> Date: Tue, 23 Dec 2025 12:06:15 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E5=AE=9E=E7=8E=B0Button=E7=BB=84?= =?UTF-8?q?=E4=BB=B6/=E6=A0=B7=E5=BC=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 相关属性对应DaisyUI的样式 --- src/lib/components/ui/button/Button.svelte | 52 +++++++++++++++++++ .../components/ui/button/button.variants.ts | 30 +++++++++++ src/lib/components/ui/button/index.ts | 1 + 3 files changed, 83 insertions(+) create mode 100644 src/lib/components/ui/button/Button.svelte create mode 100644 src/lib/components/ui/button/button.variants.ts create mode 100644 src/lib/components/ui/button/index.ts diff --git a/src/lib/components/ui/button/Button.svelte b/src/lib/components/ui/button/Button.svelte new file mode 100644 index 0000000..368ea9d --- /dev/null +++ b/src/lib/components/ui/button/Button.svelte @@ -0,0 +1,52 @@ + + + + {@render children?.()} + diff --git a/src/lib/components/ui/button/button.variants.ts b/src/lib/components/ui/button/button.variants.ts new file mode 100644 index 0000000..7640694 --- /dev/null +++ b/src/lib/components/ui/button/button.variants.ts @@ -0,0 +1,30 @@ +export const COLOR_MAP = { + neutral: 'btn-neutral', + primary: 'btn-primary', + secondary: 'btn-secondary', + accent: 'btn-accent', + info: 'btn-info', + success: 'btn-success', + warning: 'btn-warning', + error: 'btn-error', +} as const; + +export const VARIANT_MAP = { + outline: 'btn-outline', + dash: 'btn-dash', + soft: 'btn-soft', + ghost: 'btn-ghost', + link: 'btn-link', +} as const; + +export const SIZE_MAP = { + xs: 'btn-xs', + sm: 'btn-sm', + md: 'btn-md', + lg: 'btn-lg', + xl: 'btn-xl', +} as const; + +export type Color = keyof typeof COLOR_MAP; +export type Variant = keyof typeof VARIANT_MAP; +export type Size = keyof typeof SIZE_MAP; diff --git a/src/lib/components/ui/button/index.ts b/src/lib/components/ui/button/index.ts new file mode 100644 index 0000000..ae34e39 --- /dev/null +++ b/src/lib/components/ui/button/index.ts @@ -0,0 +1 @@ +export { default as Button } from './Button.svelte';