2023-05-08 09:12:53 +00: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 17:02:12 +00:00
|
|
|
export const RadioButton: React.FC<Props> = ({
|
|
|
|
name,
|
|
|
|
value,
|
|
|
|
checked,
|
|
|
|
onChange,
|
|
|
|
label,
|
|
|
|
}) => {
|
2023-05-08 09:12:53 +00: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>
|
|
|
|
);
|
|
|
|
};
|