fix bouncing help icons on mobiles devices

This commit is contained in:
Sebastian Sdorra
2018-11-13 07:39:19 +01:00
parent 24de639c1e
commit e7c9560073
11 changed files with 102 additions and 76 deletions

View File

@@ -10,7 +10,9 @@ type Props = {
disabled?: boolean,
helpText?: string
};
class Checkbox extends React.Component<Props> {
onCheckboxChange = (event: SyntheticInputEvent<HTMLInputElement>) => {
if (this.props.onChange) {
this.props.onChange(event.target.checked, this.props.name);
@@ -20,12 +22,8 @@ class Checkbox extends React.Component<Props> {
renderHelp = () => {
const helpText = this.props.helpText;
if (helpText) {
return (
<div className="control columns is-vcentered">
<Help message={helpText} />
</div>
);
} else return null;
return <Help message={helpText} />;
}
};
render() {
@@ -39,10 +37,11 @@ class Checkbox extends React.Component<Props> {
onChange={this.onCheckboxChange}
disabled={this.props.disabled}
/>
{" "}
{this.props.label}
{this.renderHelp()}
</label>
</div>
{this.renderHelp()}
</div>
);
}