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

39 lines
869 B
React
Raw Normal View History

2022-12-15 04:03:23 +08:00
import React from 'react';
import Base from './base';
2021-11-06 01:21:35 +08:00
import Styled from './styles';
2022-12-15 04:03:23 +08:00
export default class Checkbox extends Base {
2017-01-27 23:41:11 +08:00
render() {
2022-12-15 04:03:23 +08:00
const {
ariaLabel, ariaDesc, ariaDescribedBy, ariaLabelledBy, checked, disabled, label,
} = this.props;
const checkbox = (
<Styled.Checkbox
checked={checked}
disabled={disabled}
focusRipple={true}
inputProps={{
'aria-label': ariaLabel,
'aria-describedby': ariaDescribedBy,
'aria-labelledby': ariaLabelledBy,
}}
onChange={this.handleChange}
ref={this.element}
/>
);
2017-04-25 10:08:18 +08:00
2017-01-27 23:41:11 +08:00
return (
2022-12-15 04:03:23 +08:00
<>
{label ? (
<Styled.Label
label={label}
control={checkbox}
/>
) : checkbox}
2017-04-25 10:08:18 +08:00
<div id={ariaDescribedBy} hidden>{ariaDesc}</div>
2022-12-15 04:03:23 +08:00
</>
2017-01-27 23:41:11 +08:00
);
}
}