diff options
Diffstat (limited to 'src/view/com/util/forms/RadioGroup.tsx')
-rw-r--r-- | src/view/com/util/forms/RadioGroup.tsx | 46 |
1 files changed, 0 insertions, 46 deletions
diff --git a/src/view/com/util/forms/RadioGroup.tsx b/src/view/com/util/forms/RadioGroup.tsx deleted file mode 100644 index e2a26dc49..000000000 --- a/src/view/com/util/forms/RadioGroup.tsx +++ /dev/null @@ -1,46 +0,0 @@ -import {useState} from 'react' -import {View} from 'react-native' - -import {s} from '#/lib/styles' -import {ButtonType} from './Button' -import {RadioButton} from './RadioButton' - -export interface RadioGroupItem { - label: string | JSX.Element - key: string -} - -export function RadioGroup({ - testID, - type, - items, - initialSelection = '', - onSelect, -}: { - testID?: string - type?: ButtonType - items: RadioGroupItem[] - initialSelection?: string - onSelect: (key: string) => void -}) { - const [selection, setSelection] = useState<string>(initialSelection) - const onSelectInner = (key: string) => { - setSelection(key) - onSelect(key) - } - return ( - <View> - {items.map((item, i) => ( - <RadioButton - key={item.key} - testID={testID ? `${testID}-${item.key}` : undefined} - style={i !== 0 ? s.mt2 : undefined} - type={type} - label={item.label} - isSelected={item.key === selection} - onPress={() => onSelectInner(item.key)} - /> - ))} - </View> - ) -} |