bigbluebutton-Github/bigbluebutton-html5/imports/ui/components/common/radio/component.jsx

40 lines
958 B
React
Raw Normal View History

2022-12-15 04:03:23 +08:00
import React from 'react';
import Base from '../checkbox/base';
import Styled from './styles';
export default class Radio extends Base {
render() {
const {
ariaLabel, ariaDesc, ariaDescribedBy, ariaLabelledBy, checked, disabled, label,
} = this.props;
const radio = (
<Styled.Radio
checked={checked}
checkedIcon={<Styled.RadioIconChecked iconName="check" />}
icon={<Styled.RadioIcon iconName="circle" />}
disabled={disabled}
inputProps={{
'aria-label': ariaLabel,
'aria-describedby': ariaDescribedBy,
'aria-labelledby': ariaLabelledBy,
}}
onChange={this.handleChange}
ref={this.element}
/>
);
return (
<>
{label ? (
<Styled.Label
label={label}
control={radio}
/>
) : radio}
<div id={ariaDescribedBy} hidden>{ariaDesc}</div>
</>
);
}
}