updates root components structure

This commit is contained in:
Christoph Wolfes
2018-07-25 14:29:43 +02:00
parent 7b921da174
commit 7b37e4e9b6
34 changed files with 38 additions and 29 deletions

View File

@@ -0,0 +1,34 @@
//@flow
import React from "react";
type Props = {
label?: string,
checked: boolean,
onChange?: boolean => void
};
class Checkbox extends React.Component<Props> {
onCheckboxChange = (event: SyntheticInputEvent<HTMLInputElement>) => {
if (this.props.onChange) {
this.props.onChange(event.target.checked);
}
};
render() {
return (
<div className="field">
<div className="control">
<label className="checkbox">
<input
type="checkbox"
checked={this.props.checked}
onChange={this.onCheckboxChange}
/>
{this.props.label}
</label>
</div>
</div>
);
}
}
export default Checkbox;