diff --git a/src/runtime/components/Badge.vue b/src/runtime/components/Badge.vue new file mode 100644 index 00000000..e99bad04 --- /dev/null +++ b/src/runtime/components/Badge.vue @@ -0,0 +1,40 @@ + + + + + \ No newline at end of file diff --git a/src/theme/badge.ts b/src/theme/badge.ts new file mode 100644 index 00000000..686e8c3d --- /dev/null +++ b/src/theme/badge.ts @@ -0,0 +1,57 @@ +export default (config: { colors: string[] }) => ({ + base: 'rounded-md font-medium inline-flex items-center', + variants: { + color: { + ...Object.fromEntries(config.colors.map((color: string) => [color, ''])), + white: '', + gray: '', + black: '' + }, + variant: { + solid: '', + outline: '', + soft: '', + subtle: '' + }, + size: { + xs: 'text-xs px-1.5 py-0.5', + sm: 'text-xs px-2 py-1', + md: 'text-sm px-2 py-1', + lg: 'text-sm px-2.5 py-1.5' + } + }, + compoundVariants: [...config.colors.map((color: string) => ({ + color, + variant: 'solid', + class: `bg-${color}-500 dark:bg-${color}-400 text-white dark:text-gray-900` + })), ...config.colors.map((color: string) => ({ + color, + variant: 'outline', + class: `text-${color}-500 dark:text-${color}-400 ring-1 ring-inset ring-${color}-500 dark:ring-${color}-400` + })), ...config.colors.map((color: string) => ({ + color, + variant: 'soft', + class: `bg-${color}-50 dark:bg-${color}-400/10 text-${color}-500 dark:text-${color}-400` + })), ...config.colors.map((color: string) => ({ + color, + variant: 'subtle', + class: `bg-${color}-50 dark:bg-${color}-400/10 text-${color}-500 dark:text-${color}-400 ring-1 ring-inset ring-${color}-500/25 dark:ring-${color}-400/25` + })), { + color: 'white', + variant: 'solid', + class: 'ring-1 ring-inset ring-gray-300 dark:ring-gray-700 text-gray-900 dark:text-white bg-white dark:bg-gray-900' + }, { + color: 'gray', + variant: 'solid', + class: 'ring-1 ring-inset ring-gray-300 dark:ring-gray-700 text-gray-700 dark:text-gray-200 bg-gray-50 dark:bg-gray-800' + }, { + color: 'black', + variant: 'solid', + class: 'text-white dark:text-gray-900 bg-gray-900 dark:bg-white' + }], + defaultVariants: { + color: 'primary', + variant: 'solid', + size: 'sm' + } +}) \ No newline at end of file diff --git a/src/theme/index.ts b/src/theme/index.ts index 228633a5..ccdc562e 100644 --- a/src/theme/index.ts +++ b/src/theme/index.ts @@ -1,3 +1,4 @@ +export { default as badge } from './badge' export { default as button } from './button' export { default as collapsible } from './collapsible' export { default as container } from './container'