Files
super-app/components/reusable/select-button/SelectButton.tsx

35 lines
889 B
TypeScript
Raw Normal View History

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