@@ -15,7 +15,7 @@ import {
15
15
semanticColor ,
16
16
spacing ,
17
17
} from "@khanacademy/wonder-blocks-tokens" ;
18
- import { getTokenName } from "./tokens-util" ;
18
+ import { getTokenName , maybeGetCssVariableInfo } from "./tokens-util" ;
19
19
20
20
type Variant = "primitive" | "semantic" | "compact" ;
21
21
@@ -66,6 +66,8 @@ type ColorProps = {
66
66
67
67
function Color ( { name, value, variant} : ColorProps ) {
68
68
function renderInfo ( ) {
69
+ const rawValue = maybeGetCssVariableInfo ( value ) . value ;
70
+
69
71
if ( variant === "compact" ) {
70
72
const tokenName = name . toString ( ) . split ( "." ) ;
71
73
return (
@@ -83,7 +85,7 @@ function Color({name, value, variant}: ColorProps) {
83
85
84
86
< Footnote >
85
87
Primitive:{ " " }
86
- < em > { getTokenName ( color , value ) || value } </ em >
88
+ < em > { getTokenName ( color , rawValue ) || rawValue } </ em >
87
89
</ Footnote >
88
90
</ View >
89
91
) ;
@@ -114,10 +116,11 @@ function Color({name, value, variant}: ColorProps) {
114
116
{ name }
115
117
</ LabelSmall >
116
118
< Caption >
117
- Primitive: < em > { getTokenName ( color , value ) || value } </ em >
119
+ Primitive:{ " " }
120
+ < em > { getTokenName ( color , rawValue ) || rawValue } </ em >
118
121
</ Caption >
119
122
< LabelSmall >
120
- Value : < Footnote style = { styles . code } > { value } </ Footnote >
123
+ Reference : < Footnote style = { styles . code } > { value } </ Footnote >
121
124
</ LabelSmall >
122
125
</ >
123
126
) ;
@@ -160,8 +163,8 @@ type ActionColorGroupProps = {
160
163
} ;
161
164
162
165
export function ActionColorGroup ( { category, group} : ActionColorGroupProps ) {
163
- return Object . entries ( category ) . map ( ( [ state , colorGroup ] ) => (
164
- < View style = { styles . actionGroup } >
166
+ return Object . entries ( category ) . map ( ( [ state , colorGroup ] , index ) => (
167
+ < View style = { styles . actionGroup } key = { index } >
165
168
< LabelLarge style = { styles . capitalized } > { state } </ LabelLarge >
166
169
< Example style = { colorGroup } />
167
170
< ColorGroup
0 commit comments