mirror of
https://github.com/Comfy-Org/ComfyUI_frontend.git
synced 2026-04-20 14:30:41 +00:00
## Summary - Rename `text-xxxs`/`text-xxs` to `text-3xs`/`text-2xs` in design system CSS — fixes `tailwind-merge` incorrectly classifying custom font-size utilities as color classes, which clobbered text color - Add `Badge` component with updated severity colors matching Figma design (white text on colored backgrounds) - Add Badge stories under `Components/Badges/Badge` - Add unit tests including twMerge regression coverage Split from #10438 per review feedback — this PR contains the foundational Badge component; migration of consumers follows in a separate PR. ## Test plan - [x] Unit tests pass (`Badge.test.ts` — 12 tests) - [x] Typecheck passes - [x] Lint passes - [ ] Verify Badge stories render correctly in Storybook - [ ] Verify existing components using `text-2xs`/`text-3xs` render unchanged Fixes #10438 (partial) ┆Issue is synchronized with this [Notion page](https://www.notion.so/PR-10580-refactor-add-Badge-component-and-fix-twMerge-font-size-detection-32f6d73d3650810dae7cd0d4af67fd1c) by [Unito](https://www.unito.io)
37 lines
671 B
Vue
37 lines
671 B
Vue
<script setup lang="ts">
|
|
import { computed } from 'vue'
|
|
|
|
import { cn } from '@/utils/tailwindUtil'
|
|
|
|
import { badgeVariants } from './badge.variants'
|
|
import type { BadgeVariants } from './badge.variants'
|
|
|
|
const {
|
|
label,
|
|
severity = 'default',
|
|
variant,
|
|
class: className
|
|
} = defineProps<{
|
|
label?: string | number
|
|
severity?: BadgeVariants['severity']
|
|
variant?: BadgeVariants['variant']
|
|
class?: string
|
|
}>()
|
|
|
|
const badgeClass = computed(() =>
|
|
cn(
|
|
badgeVariants({
|
|
severity,
|
|
variant: variant ?? (label == null ? 'dot' : 'label')
|
|
}),
|
|
className
|
|
)
|
|
)
|
|
</script>
|
|
|
|
<template>
|
|
<span :class="badgeClass">
|
|
{{ label }}
|
|
</span>
|
|
</template>
|