@@ -6,6 +6,7 @@ import { Paragraph } from "../primitives/Paragraph";
66import { Popover , PopoverContent , PopoverTrigger } from "../primitives/Popover" ;
77import { Select , SelectItem } from "../primitives/Select" ;
88import { Switch } from "../primitives/Switch" ;
9+ import SegmentedControl from "../primitives/SegmentedControl" ;
910import { Button } from "../primitives/Buttons" ;
1011import {
1112 type AggregationType ,
@@ -234,54 +235,38 @@ export function ChartConfigPanel({ columns, config, onChange, className }: Chart
234235 }
235236
236237 return (
237- < div className = { cn ( "flex flex-col gap-2 p-2" , className ) } >
238+ < div className = { cn ( "flex flex-col gap-3 p-2" , className ) } >
238239 { /* Chart Type */ }
239240 < div className = "flex flex-col gap-3" >
240241 < ConfigField label = "Type" >
241- < div className = "flex items-center" >
242- < Button
243- type = "button"
244- variant = "tertiary/small"
245- className = { cn (
246- "rounded-r-none border-b pl-1 pr-2" ,
247- config . chartType === "bar" ? "border-indigo-500" : "border-transparent"
248- ) }
249- iconSpacing = "gap-x-1"
250- onClick = { ( ) => updateConfig ( { chartType : "bar" } ) }
251- LeadingIcon = { BarChart }
252- leadingIconClassName = {
253- config . chartType === "bar" ? "text-indigo-500" : "text-text-dimmed"
254- }
255- >
256- < span className = { config . chartType === "bar" ? "text-indigo-500" : "text-text-dimmed" } >
257- Bar
258- </ span >
259- </ Button >
260- < Button
261- type = "button"
262- variant = "tertiary/small"
263- className = { cn (
264- "rounded-l-none border-b pl-1 pr-2" ,
265- config . chartType === "line" ? "border-indigo-500" : "border-transparent"
266- ) }
267- iconSpacing = "gap-x-1"
268- onClick = { ( ) => updateConfig ( { chartType : "line" } ) }
269- LeadingIcon = { LineChart }
270- leadingIconClassName = {
271- config . chartType === "line" ? "text-indigo-500" : "text-text-dimmed"
272- }
273- >
274- < span
275- className = { config . chartType === "line" ? "text-indigo-500" : "text-text-dimmed" }
276- >
277- Line
278- </ span >
279- </ Button >
280- </ div >
242+ < SegmentedControl
243+ name = "chartType"
244+ value = { config . chartType }
245+ variant = "secondary/small"
246+ options = { [
247+ {
248+ label : (
249+ < span className = "flex items-center gap-1" >
250+ < BarChart className = "size-3" /> Bar
251+ </ span >
252+ ) ,
253+ value : "bar" ,
254+ } ,
255+ {
256+ label : (
257+ < span className = "flex items-center gap-1" >
258+ < LineChart className = "size-3" /> Line
259+ </ span >
260+ ) ,
261+ value : "line" ,
262+ } ,
263+ ] }
264+ onChange = { ( value ) => updateConfig ( { chartType : value as "bar" | "line" } ) }
265+ />
281266 </ ConfigField >
282267 </ div >
283268
284- < div className = "flex flex-col gap-2 " >
269+ < div className = "flex flex-col gap-3 " >
285270 { /* X-Axis */ }
286271 < ConfigField label = "X-Axis" >
287272 < Select
@@ -543,7 +528,7 @@ export function ChartConfigPanel({ columns, config, onChange, className }: Chart
543528function ConfigField ( { label, children } : { label : string ; children : React . ReactNode } ) {
544529 return (
545530 < div className = "flex flex-col gap-1" >
546- { label && < span className = "text-xs text-text-dimmed " > { label } </ span > }
531+ { label && < span className = "text-xs text-text-bright " > { label } </ span > }
547532 { children }
548533 </ div >
549534 ) ;
0 commit comments