(props: Props)
| 25 | } |
| 26 | |
| 27 | export default function ToggleGroup(props: Props) { |
| 28 | const { value, onChange, responsive = true, options } = props |
| 29 | |
| 30 | const isMobile = useMobile() |
| 31 | if (isMobile && responsive) { |
| 32 | return ( |
| 33 | <Select value={value} onValueChange={onChange}> |
| 34 | <SelectTrigger className="w-[180px]"> |
| 35 | <SelectValue placeholder="Select a fruit" /> |
| 36 | </SelectTrigger> |
| 37 | <SelectContent> |
| 38 | {options.map(option => ( |
| 39 | <SelectItem key={option.value} value={option.value}> |
| 40 | {option.label} |
| 41 | </SelectItem> |
| 42 | ))} |
| 43 | </SelectContent> |
| 44 | </Select> |
| 45 | ) |
| 46 | } |
| 47 | |
| 48 | return ( |
| 49 | <_ToggleGroup |
| 50 | type="single" |
| 51 | variant="outline" |
| 52 | value={value} |
| 53 | onValueChange={onChange} |
| 54 | > |
| 55 | {options.map(option => ( |
| 56 | <ToggleGroupItem key={option.value} value={option.value}> |
| 57 | {option.label} |
| 58 | </ToggleGroupItem> |
| 59 | ))} |
| 60 | </_ToggleGroup> |
| 61 | ) |
| 62 | } |
nothing calls this directly
no test coverage detected