Files
super-app/components/reusable/select-button/SelectButton.tsx
2024-12-18 16:05:15 +00:00

35 lines
889 B
TypeScript

import { View, ViewStyle } from "react-native";
import { SelectButtonType } from "../../../App/common/constants";
import { styles } from "./SelectButtonStyles";
interface SelectButtonProps {
selected?: boolean;
type?: string;
buttonStyle?: ViewStyle;
}
const RadioButton = ({ selected, buttonStyle }: SelectButtonProps) => {
return (
<View
style={[
styles.radioButton,
buttonStyle,
selected && styles.selectedRadioButton,
]}
>
{selected && <View style={styles.innerRadio} />}
</View>
);
};
const SelectButton = ({ selected, type, buttonStyle }: SelectButtonProps) => {
switch (type) {
case SelectButtonType.RADIO:
return <RadioButton selected={selected} buttonStyle={buttonStyle} />;
default:
return <RadioButton selected={selected} buttonStyle={buttonStyle} />;
}
};
export default SelectButton;