Files
SCM-Manager/scm-ui/src/components/Checkbox.js

33 lines
693 B
JavaScript
Raw Normal View History

2018-07-11 17:02:38 +02:00
//@flow
import React from "react";
type Props = {
label: string,
2018-07-17 08:39:51 +02:00
checked: boolean,
2018-07-11 17:02:38 +02:00
onChange: boolean => void
};
class Checkbox extends React.Component<Props> {
onCheckboxChange = (event: SyntheticInputEvent<HTMLInputElement>) => {
this.props.onChange(event.target.checked);
};
render() {
return (
<div className="field">
<div className="control">
<label className="checkbox">
2018-07-17 08:39:51 +02:00
<input
type="checkbox"
checked={this.props.checked}
onChange={this.onCheckboxChange}
/>
2018-07-11 17:02:38 +02:00
{this.props.label}
</label>
</div>
</div>
);
}
}
export default Checkbox;