2023-05-08 11:12:53 +02:00
|
|
|
import React from 'react';
|
|
|
|
import classNames from 'classnames';
|
|
|
|
|
|
|
|
type Props = {
|
|
|
|
value: string;
|
|
|
|
checked: boolean;
|
|
|
|
name: string;
|
|
|
|
onChange: (event: React.ChangeEvent<HTMLInputElement>) => void;
|
|
|
|
label: React.ReactNode;
|
|
|
|
};
|
|
|
|
|
2023-05-09 19:02:12 +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>
|
|
|
|
);
|
|
|
|
};
|