@@ -4,12 +4,11 @@ import {
4
4
resetClasses ,
5
5
variantClassNames ,
6
6
} from "../../util/classes" ;
7
- import { DisplayOnProps } from "../../util/theme" ;
8
7
9
- export interface SegmentedControlProps < T extends string >
10
- extends DisplayOnProps {
8
+ export interface SegmentedControlProps < T extends string > {
11
9
options : SegmentedControlOption < T > [ ] ;
12
10
onOptionChange : ( option : SegmentedControlOption < T > , index : number ) => void ;
11
+ variant ?: "purple" | "transparent" ;
13
12
}
14
13
15
14
export interface SegmentedControlOption < T extends string > {
@@ -21,7 +20,7 @@ export interface SegmentedControlOption<T extends string> {
21
20
export const SegmentedControl = < T extends string > ( {
22
21
options,
23
22
onOptionChange,
24
- displayOn = "auto " ,
23
+ variant = "transparent " ,
25
24
} : SegmentedControlProps < T > ) => {
26
25
const itemsRef = useRef < Array < HTMLButtonElement | null > > ( [ ] ) ;
27
26
const [ selectedOption , setSelectedOption ] = useState < T | null > (
@@ -65,10 +64,9 @@ export const SegmentedControl = <T extends string>({
65
64
< div
66
65
className = { classNames (
67
66
"ink-w-full ink-h-full ink-rounded-full" ,
68
- variantClassNames ( displayOn , {
69
- auto : "ink-bg-background-light dark:ink-bg-background-dark" ,
70
- white : "ink-bg-background-light" ,
71
- black : "ink-bg-background-dark" ,
67
+ variantClassNames ( variant , {
68
+ purple : "ink-bg-background-light" ,
69
+ transparent : "ink-bg-background-dark" ,
72
70
} )
73
71
) }
74
72
/>
@@ -77,10 +75,9 @@ export const SegmentedControl = <T extends string>({
77
75
< div
78
76
className = { classNames (
79
77
"ink-grid ink-gap-2 ink-grid-flow-col [grid-auto-columns:1fr] ink-text-body-2 ink-font-bold ink-rounded-full" ,
80
- variantClassNames ( displayOn , {
81
- auto : "ink-bg-background-container dark:ink-bg-background-light" ,
82
- white : "ink-bg-background-container" ,
83
- black : "ink-bg-background-light" ,
78
+ variantClassNames ( variant , {
79
+ purple : "ink-bg-background-container" ,
80
+ transparent : "ink-bg-background-light" ,
84
81
} )
85
82
) }
86
83
>
0 commit comments