2023-05-08 11:12:53 +02:00
|
|
|
import classNames from 'classnames';
|
|
|
|
|
2023-05-10 12:59:29 +02:00
|
|
|
interface Props {
|
2023-05-08 11:12:53 +02:00
|
|
|
value: string;
|
|
|
|
checked: boolean;
|
|
|
|
name: string;
|
|
|
|
onChange: (event: React.ChangeEvent<HTMLInputElement>) => void;
|
|
|
|
label: React.ReactNode;
|
2023-05-10 12:59:29 +02:00
|
|
|
}
|
2023-05-08 11:12:53 +02:00
|
|
|
|
2023-05-09 23:41:18 +02:00
|
|
|
export const RadioButton: React.FC<Props> = ({
|
|
|
|
name,
|
|
|
|
value,
|
|
|
|
checked,
|
|
|
|
onChange,
|
|
|
|
label,
|
|
|
|
}) => {
|
2023-05-08 11:12:53 +02:00
|
|
|
return (
|
|
|
|
<label className='radio-button'>
|
|
|
|
<input
|
|
|
|
name={name}
|
|
|
|
type='radio'
|
|
|
|
value={value}
|
|
|
|
checked={checked}
|
|
|
|
onChange={onChange}
|
|
|
|
/>
|
|
|
|
|
|
|
|
<span className={classNames('radio-button__input', { checked })} />
|
|
|
|
|
|
|
|
<span>{label}</span>
|
|
|
|
</label>
|
|
|
|
);
|
|
|
|
};
|