@@ -19,9 +19,30 @@ export interface TokenCellProps {
1919 resolvedValue : AST . ValueLit ;
2020}
2121
22+ function renderGradientWithTokens ( gradient : AST . GradientLit ) {
23+ return (
24+ < span >
25+ { gradient . stops . map ( ( stop , index ) => (
26+ < Fragment key = { index } >
27+ { stop . color . kind === "TokenLit" ? (
28+ < TokenLink id = { stop . color . identifier } />
29+ ) : (
30+ stop . color . value
31+ ) } { " " }
32+ { ( stop . position . value * 100 ) . toFixed ( 1 ) } %{ index < gradient . stops . length - 1 ? ", " : "" }
33+ </ Fragment >
34+ ) ) }
35+ </ span >
36+ ) ;
37+ }
38+
2239export function TokenCell ( props : TokenCellProps ) {
2340 const { isExpanded, values, resolvedValue } = props ;
2441
42+ const isGradientWithTokens =
43+ resolvedValue . kind === "GradientLit" &&
44+ resolvedValue . stops . some ( ( stop ) => stop . color . kind === "TokenLit" ) ;
45+
2546 return (
2647 < div className = "flex justify-between" aria-expanded = { isExpanded } >
2748 < div className = "flex flex-col gap-1" >
@@ -30,7 +51,9 @@ export function TokenCell(props: TokenCellProps) {
3051 < Fragment key = { item . ref } >
3152 < div className = "flex items-center gap-2" >
3253 < TypeIndicator value = { resolvedValue } /> { " " }
33- { item . ref . startsWith ( "$" ) ? (
54+ { index === values . length - 1 && isGradientWithTokens ? (
55+ renderGradientWithTokens ( resolvedValue as AST . GradientLit )
56+ ) : item . ref . startsWith ( "$" ) ? (
3457 < TokenLink id = { item . ref } description = { item . description } />
3558 ) : (
3659 item . ref
@@ -46,7 +69,9 @@ export function TokenCell(props: TokenCellProps) {
4669 ) : (
4770 < div className = "flex items-center gap-2" >
4871 < TypeIndicator value = { resolvedValue } /> { " " }
49- { values [ 0 ] . ref . startsWith ( "$" ) ? (
72+ { isGradientWithTokens ? (
73+ renderGradientWithTokens ( resolvedValue as AST . GradientLit )
74+ ) : values [ 0 ] . ref . startsWith ( "$" ) ? (
5075 < TokenLink id = { values [ 0 ] . ref } description = { values [ 0 ] . description } />
5176 ) : (
5277 values [ 0 ] . ref
0 commit comments