mirror of
https://github.com/glitch-soc/mastodon.git
synced 2024-11-24 17:14:15 -05:00
29 lines
633 B
TypeScript
29 lines
633 B
TypeScript
|
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;
|
||
|
};
|
||
|
|
||
|
export const RadioButton: React.FC<Props> = ({ name, value, checked, onChange, label }) => {
|
||
|
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>
|
||
|
);
|
||
|
};
|