11import { theme } from '@ultraviolet/themes'
2- import type { RecipeVariants } from '@vanilla-extract/recipes'
32import { recipe } from '@vanilla-extract/recipes'
4- import type { Color } from '../../theme'
53import { style } from '@vanilla-extract/css'
64
75const SENTIMENTS = [
@@ -12,15 +10,8 @@ const SENTIMENTS = [
1210 'secondary' ,
1311 'success' ,
1412 'warning' ,
15- ] as Color [ ]
13+ ] as const
1614
17- function getSentimentStyle ( sentiment : ( typeof SENTIMENTS ) [ number ] ) {
18- return {
19- color : theme . colors [ sentiment ] . text ,
20- background : theme . colors [ sentiment ] . background ,
21- border : `solid 1px ${ sentiment === 'neutral' ? theme . colors . neutral . border : theme . colors [ sentiment ] . background } ` ,
22- }
23- }
2415export const containerTag = recipe ( {
2516 base : {
2617 display : 'inline-flex' ,
@@ -49,16 +40,16 @@ export const containerTag = recipe({
4940 } ,
5041 } ,
5142
52- sentiment : {
53- danger : getSentimentStyle ( 'danger' ) ,
54- info : getSentimentStyle ( 'info' ) ,
55- neutral : getSentimentStyle ( 'neutral' ) ,
56- primary : getSentimentStyle ( 'primary' ) ,
57- secondary : getSentimentStyle ( 'secondary' ) ,
58- success : getSentimentStyle ( 'success' ) ,
59- warning : getSentimentStyle ( 'warning' ) ,
60- } ,
61-
43+ sentiment : Object . fromEntries (
44+ SENTIMENTS . map ( sentiment => [
45+ sentiment ,
46+ {
47+ color : theme . colors [ sentiment ] . text ,
48+ background : theme . colors [ sentiment ] . background ,
49+ border : `solid 1px ${ sentiment === 'neutral' ? theme . colors . neutral . border : theme . colors [ sentiment ] . background } ` ,
50+ } ,
51+ ] ) ,
52+ ) ,
6253 disabled : {
6354 true : {
6455 color : theme . colors . neutral . textDisabled ,
@@ -84,5 +75,3 @@ export const closeButtonTag = style({
8475 height : 'fit-content' ,
8576 padding : theme . space [ '0.25' ] ,
8677} )
87-
88- export type TagVariants = NonNullable < RecipeVariants < typeof containerTag > >
0 commit comments