mirror of
https://git.kescher.at/CatCatNya/catstodon.git
synced 2024-11-30 16:49:04 +01:00
81ef21a0c8
Port 44a7d87cb1
to glitch-soc
Signed-off-by: Claire <claire.github-309c@sitedethib.com>
35 lines
803 B
JavaScript
35 lines
803 B
JavaScript
import React from 'react';
|
|
import PropTypes from 'prop-types';
|
|
import classNames from 'classnames';
|
|
|
|
export default class RadioButton extends React.PureComponent {
|
|
|
|
static propTypes = {
|
|
value: PropTypes.string.isRequired,
|
|
checked: PropTypes.bool,
|
|
name: PropTypes.string.isRequired,
|
|
onChange: PropTypes.func.isRequired,
|
|
label: PropTypes.node.isRequired,
|
|
};
|
|
|
|
render () {
|
|
const { name, value, checked, onChange, label } = this.props;
|
|
|
|
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>
|
|
);
|
|
}
|
|
|
|
}
|