2020-06-22 14:00:51 +03:00
|
|
|
import * as React from 'react';
|
|
|
|
import * as System from '~/components/system';
|
|
|
|
|
|
|
|
import SystemPage from '~/components/system/SystemPage';
|
2020-06-22 14:15:04 +03:00
|
|
|
import ViewSourceLink from '~/components/system/ViewSourceLink';
|
2020-06-22 14:00:51 +03:00
|
|
|
|
|
|
|
export default class SystemPageCheckboxes extends React.Component {
|
|
|
|
state = {
|
|
|
|
six: false,
|
|
|
|
seven: true,
|
|
|
|
};
|
|
|
|
|
|
|
|
_handleChange = (e) => {
|
|
|
|
this.setState({ [e.target.name]: e.target.value });
|
|
|
|
};
|
|
|
|
|
|
|
|
render() {
|
|
|
|
return (
|
2020-07-01 10:31:55 +03:00
|
|
|
<SystemPage title="SDS: Checkboxes" description="..." url="https://fps.onrender.com/system/checkboxes">
|
2020-06-22 14:15:04 +03:00
|
|
|
<System.H1>
|
2020-07-01 10:31:55 +03:00
|
|
|
Checkboxes <ViewSourceLink file="system/checkboxes.js" />
|
2020-06-22 14:15:04 +03:00
|
|
|
</System.H1>
|
2020-06-22 14:00:51 +03:00
|
|
|
<br />
|
|
|
|
<br />
|
2020-06-24 05:02:55 +03:00
|
|
|
<System.P>
|
|
|
|
The Checkbox component is used in forms when a users needs to select one or more values from multiple options.
|
|
|
|
</System.P>
|
2020-06-22 14:00:51 +03:00
|
|
|
<br />
|
|
|
|
<br />
|
2020-06-24 05:02:55 +03:00
|
|
|
<br />
|
|
|
|
<System.H2>Usage</System.H2>
|
|
|
|
<hr />
|
|
|
|
<br />
|
2020-07-01 10:31:55 +03:00
|
|
|
<System.P>
|
|
|
|
Define the boolean Checkbox states and handle the state change the when user checks or unchecks the CheckBox.
|
|
|
|
</System.P>
|
2020-06-24 05:02:55 +03:00
|
|
|
<br />
|
|
|
|
<System.CodeBlock>
|
2020-07-01 10:31:55 +03:00
|
|
|
{`state = {
|
2020-06-24 05:02:55 +03:00
|
|
|
six: false,
|
|
|
|
seven: true,
|
|
|
|
};
|
|
|
|
|
|
|
|
_handleChange = (e) => {
|
|
|
|
this.setState({ [e.target.name]: e.target.value });
|
|
|
|
}; `}
|
|
|
|
</System.CodeBlock>
|
|
|
|
<br />
|
|
|
|
<br />
|
|
|
|
<System.P>Declare the CheckBox component.</System.P>
|
|
|
|
<br />
|
|
|
|
|
|
|
|
<System.CodeBlock>
|
2020-07-01 10:31:55 +03:00
|
|
|
{`<System.CheckBox name="six" value={this.state.six} onChange={this._handleChange}>
|
2020-06-24 05:02:55 +03:00
|
|
|
<strong>Unchecked</strong>
|
|
|
|
<br />
|
|
|
|
This CheckBox default is unchecked.
|
|
|
|
</System.CheckBox>
|
|
|
|
|
|
|
|
<System.CheckBox name="seven" value={this.state.seven} onChange={this._handleChange}>
|
|
|
|
<strong>Checked</strong>
|
|
|
|
<br />
|
|
|
|
This CheckBox default is checked.
|
|
|
|
</System.CheckBox>`}
|
|
|
|
</System.CodeBlock>
|
|
|
|
<br />
|
|
|
|
<br />
|
|
|
|
<System.H2>Output</System.H2>
|
|
|
|
<hr />
|
|
|
|
<br />
|
2020-06-22 14:00:51 +03:00
|
|
|
<System.CheckBox name="six" value={this.state.six} onChange={this._handleChange}>
|
2020-06-24 05:02:55 +03:00
|
|
|
<strong>Unchecked</strong>
|
2020-06-22 14:00:51 +03:00
|
|
|
<br />
|
2020-06-24 05:02:55 +03:00
|
|
|
This CheckBox default is unchecked.
|
2020-06-22 14:00:51 +03:00
|
|
|
</System.CheckBox>
|
|
|
|
<br />
|
|
|
|
<br />
|
|
|
|
<System.CheckBox name="seven" value={this.state.seven} onChange={this._handleChange}>
|
2020-06-24 05:02:55 +03:00
|
|
|
<strong>Checked</strong>
|
|
|
|
<br />
|
|
|
|
This CheckBox default is checked.
|
2020-06-22 14:00:51 +03:00
|
|
|
</System.CheckBox>
|
|
|
|
</SystemPage>
|
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|