This repository has been archived on 2024-07-22. You can view files and clone it, but cannot push or open issues or pull requests.
2023-05-28 05:18:23 -07:00
|
|
|
import * as React from 'react';
|
2023-05-10 03:59:29 -07:00
|
|
|
|
2023-05-08 02:12:53 -07:00
|
|
|
import classNames from 'classnames';
|
|
|
|
|
2023-05-10 03:59:29 -07:00
|
|
|
interface Props {
|
2023-05-08 02:12:53 -07:00
|
|
|
value: string;
|
|
|
|
checked: boolean;
|
|
|
|
name: string;
|
|
|
|
onChange: (event: React.ChangeEvent<HTMLInputElement>) => void;
|
|
|
|
label: React.ReactNode;
|
2023-05-10 03:59:29 -07:00
|
|
|
}
|
2023-05-08 02:12:53 -07:00
|
|
|
|
2023-05-09 14:41:18 -07:00
|
|
|
export const RadioButton: React.FC<Props> = ({
|
|
|
|
name,
|
|
|
|
value,
|
|
|
|
checked,
|
|
|
|
onChange,
|
|
|
|
label,
|
|
|
|
}) => {
|
2023-05-08 02:12:53 -07: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>
|
|
|
|
);
|
|
|
|
};
|