feat(ui): Badge with tones
This commit is contained in:
1 parent
b806bedc4f
commit
03332246d3
1 file changed
+24
-2
@@ -1,3 +1,25 @@
|
|||||||
export default function Badge() {
|
import type { ReactNode } from 'react'
|
||||||
return <div>Badge placeholder</div>
|
|
||||||
|
export default function Badge({
|
||||||
|
children,
|
||||||
|
tone = 'neutral',
|
||||||
|
className = '',
|
||||||
|
}: {
|
||||||
|
children: ReactNode
|
||||||
|
tone?: 'neutral' | 'accent' | 'warn' | 'danger'
|
||||||
|
className?: string
|
||||||
|
}) {
|
||||||
|
const map = {
|
||||||
|
neutral: 'bg-[var(--color-surface-strong)] text-[var(--color-ink)]',
|
||||||
|
accent: 'bg-[var(--color-accent)]/10 text-[var(--color-accent-strong)]',
|
||||||
|
warn: 'bg-amber-50 text-amber-700',
|
||||||
|
danger: 'bg-red-50 text-red-700',
|
||||||
|
} as const
|
||||||
|
return (
|
||||||
|
<span
|
||||||
|
className={`inline-flex items-center px-2 py-0.5 rounded-md text-xs font-medium ${map[tone]} ${className}`}
|
||||||
|
>
|
||||||
|
{children}
|
||||||
|
</span>
|
||||||
|
)
|
||||||
}
|
}
|
||||||
Reference in new issue
Block a user