22
33import {
44 Badge ,
5- Box ,
65 Button ,
76 Card ,
87 Checkbox ,
@@ -17,142 +16,75 @@ import {
1716 Textarea ,
1817 VStack ,
1918} from '@trycompai/ui-new' ;
19+ import { useState } from 'react' ;
20+ import { ButtonPaletteSwitcher , type ButtonColorPalette } from './ButtonPaletteSwitcher' ;
2021import { ColorRow , Section , SubSection } from './TestUiPrimitives' ;
2122
2223export function TestUiSectionsTop ( ) {
24+ const [ buttonPalette , setButtonPalette ] = useState < ButtonColorPalette > ( 'primary' ) ;
25+
2326 return (
2427 < >
25- < Section title = "Color Tokens (Comp)" >
26- < Text color = "gray.600" mb = { 4 } >
27- Theme palettes (primary, secondary, and accent palettes)
28- </ Text >
28+ < Section title = "Color Tokens" >
2929 < VStack align = "start" gap = { 8 } >
30- < ColorRow name = "primary" description = "comp green" />
31- < ColorRow name = "secondary" description = "neutral / gray scale" />
32- < ColorRow name = "blue" description = "accent blue" />
33- < ColorRow name = "orange" description = "accent orange" />
34- < ColorRow name = "rose" description = "accent rose" />
35- < ColorRow name = "yellow" description = "accent yellow" />
36- < ColorRow name = "sand" description = "accent sand" />
30+ < ColorRow name = "primary" />
31+ < ColorRow name = "secondary" />
32+ < ColorRow name = "blue" />
33+ < ColorRow name = "orange" />
34+ < ColorRow name = "rose" />
35+ < ColorRow name = "yellow" />
36+ < ColorRow name = "sand" />
3737 </ VStack >
3838 </ Section >
3939
40- < Section title = "Surface Tokens" >
41- < Text color = "gray.600" mb = { 4 } >
42- Simple surfaces using our theme palettes
43- </ Text >
44- < Grid templateColumns = { { base : '1fr' , md : 'repeat(3, 1fr)' } } gap = { 4 } >
45- < Box
46- bg = "white"
47- color = "gray.900"
48- p = { 4 }
49- borderWidth = "1px"
50- borderColor = "secondary.200"
51- borderRadius = "md"
52- >
53- white / gray.900
54- </ Box >
55- < Box
56- bg = "secondary.50"
57- color = "secondary.900"
58- p = { 4 }
59- borderWidth = "1px"
60- borderColor = "secondary.200"
61- borderRadius = "md"
62- >
63- secondary.50 / secondary.900
64- </ Box >
65- < Box
66- bg = "secondary.100"
67- color = "secondary.900"
68- p = { 4 }
69- borderWidth = "1px"
70- borderColor = "secondary.200"
71- borderRadius = "md"
72- >
73- secondary.100 / secondary.900
74- </ Box >
75- < Box
76- bg = "secondary.900"
77- color = "white"
78- p = { 4 }
79- borderWidth = "1px"
80- borderColor = "secondary.700"
81- borderRadius = "md"
82- >
83- secondary.900 / white
84- </ Box >
85- < Box
86- bg = "primary.50"
87- color = "primary.900"
88- p = { 4 }
89- borderWidth = "1px"
90- borderColor = "primary.200"
91- borderRadius = "md"
92- >
93- primary.50 / primary.900
94- </ Box >
95- < Box
96- bg = "blue.50"
97- color = "blue.900"
98- p = { 4 }
99- borderWidth = "1px"
100- borderColor = "blue.200"
101- borderRadius = "md"
102- >
103- blue.50 / blue.900
104- </ Box >
105- </ Grid >
106- < HStack gap = { 4 } mt = { 4 } flexWrap = "wrap" >
107- < Box p = { 4 } borderWidth = "1px" borderColor = "secondary.200" borderRadius = "md" >
108- border: secondary.200
109- </ Box >
110- < Box p = { 4 } borderWidth = "2px" borderColor = "primary.700" borderRadius = "md" >
111- focus: primary.700
112- </ Box >
113- </ HStack >
114- </ Section >
115-
11640 < Section title = "Buttons" >
117- < SubSection title = "Default (Primary)" >
118- < Text color = "gray.600" fontSize = "sm" mb = { 2 } >
119- Button variants
120- </ Text >
121- < HStack gap = { 4 } flexWrap = "wrap" >
122- < Button > Default Button</ Button >
123- < Button variant = "outline" > Outline</ Button >
124- < Button variant = "ghost" > Ghost</ Button >
125- < Button variant = "plain" > Plain</ Button >
126- </ HStack >
127- </ SubSection >
128-
129- < SubSection title = "Color Palettes" >
41+ < HStack mb = { 3 } >
42+ < ButtonPaletteSwitcher value = { buttonPalette } onChange = { setButtonPalette } />
43+ </ HStack >
44+ < SubSection title = "Variants" >
13045 < HStack gap = { 4 } flexWrap = "wrap" >
131- < Button colorPalette = "primary" > Primary</ Button >
132- < Button colorPalette = "secondary" > Secondary</ Button >
133- < Button colorPalette = "blue" > Blue</ Button >
134- < Button colorPalette = "orange" > Orange</ Button >
135- < Button colorPalette = "rose" > Rose</ Button >
136- < Button colorPalette = "yellow" > Yellow</ Button >
137- < Button colorPalette = "sand" > Sand</ Button >
46+ < Button colorPalette = { buttonPalette } > Default Button</ Button >
47+ < Button colorPalette = { buttonPalette } variant = "outline" >
48+ Outline
49+ </ Button >
50+ < Button colorPalette = { buttonPalette } variant = "ghost" >
51+ Ghost
52+ </ Button >
53+ < Button colorPalette = { buttonPalette } variant = "link" >
54+ Link
55+ </ Button >
13856 </ HStack >
13957 </ SubSection >
14058
14159 < SubSection title = "Sizes" >
14260 < HStack gap = { 4 } alignItems = "center" flexWrap = "wrap" >
143- < Button size = "xs" > XS</ Button >
144- < Button size = "sm" > SM</ Button >
145- < Button size = "md" > MD</ Button >
146- < Button size = "lg" > LG</ Button >
147- < Button size = "xl" > XL</ Button >
61+ < Button colorPalette = { buttonPalette } size = "xs" >
62+ XS
63+ </ Button >
64+ < Button colorPalette = { buttonPalette } size = "sm" >
65+ SM
66+ </ Button >
67+ < Button colorPalette = { buttonPalette } size = "md" >
68+ MD
69+ </ Button >
70+ < Button colorPalette = { buttonPalette } size = "lg" >
71+ LG
72+ </ Button >
73+ < Button colorPalette = { buttonPalette } size = "xl" >
74+ XL
75+ </ Button >
14876 </ HStack >
14977 </ SubSection >
15078
15179 < SubSection title = "States" >
15280 < HStack gap = { 4 } flexWrap = "wrap" >
153- < Button > Normal</ Button >
154- < Button disabled > Disabled</ Button >
155- < Button loading > Loading</ Button >
81+ < Button colorPalette = { buttonPalette } > Normal</ Button >
82+ < Button colorPalette = { buttonPalette } disabled >
83+ Disabled
84+ </ Button >
85+ < Button colorPalette = { buttonPalette } loading >
86+ Loading
87+ </ Button >
15688 </ HStack >
15789 </ SubSection >
15890 </ Section >
0 commit comments