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
|
|
|
|
|
|
|
const TAB_GROUP_TWO = [
|
|
|
|
{ value: '1', label: 'Capricorn' },
|
|
|
|
{ value: '2', label: 'Aquarius' },
|
|
|
|
];
|
|
|
|
|
|
|
|
const TAB_GROUP_THREE = [
|
|
|
|
{ value: '1', label: 'Capricorn' },
|
|
|
|
{ value: '2', label: 'Aquarius' },
|
|
|
|
{ value: '3', label: 'Pisces' },
|
|
|
|
];
|
|
|
|
|
|
|
|
const TAB_GROUP_FOUR = [
|
|
|
|
{ value: '1', label: 'Capricorn' },
|
|
|
|
{ value: '2', label: 'Aquarius' },
|
|
|
|
{ value: '3', label: 'Pisces' },
|
|
|
|
{ value: '4', label: 'Aries' },
|
|
|
|
];
|
|
|
|
|
|
|
|
export default class SystemPageTabs extends React.Component {
|
|
|
|
state = {
|
2020-07-04 08:05:39 +03:00
|
|
|
default: '1',
|
2020-06-22 14:00:51 +03:00
|
|
|
eight: '1',
|
2020-07-04 08:05:39 +03:00
|
|
|
nine: '3',
|
2020-06-22 14:00:51 +03:00
|
|
|
ten: '1',
|
|
|
|
};
|
|
|
|
|
|
|
|
_handleChange = (e) => {
|
|
|
|
this.setState({ [e.target.name]: e.target.value });
|
|
|
|
};
|
|
|
|
|
|
|
|
render() {
|
|
|
|
return (
|
2020-07-01 10:31:55 +03:00
|
|
|
<SystemPage title="SDS: Tabs" description="..." url="https://fps.onrender.com/system/tabs">
|
2020-06-22 14:15:04 +03:00
|
|
|
<System.H1>
|
2020-07-01 10:31:55 +03:00
|
|
|
Tabs <ViewSourceLink file="system/tabs.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 TabGroup component is used to allow the users to switch between views.</System.P>
|
2020-06-22 14:00:51 +03:00
|
|
|
<br />
|
|
|
|
<br />
|
2020-07-03 19:38:44 +03:00
|
|
|
<br />
|
|
|
|
<System.H2>Imports</System.H2>
|
|
|
|
<hr />
|
|
|
|
<br />
|
|
|
|
<System.P>
|
|
|
|
Import React and the TabGroup Component.
|
|
|
|
</System.P>
|
|
|
|
<br />
|
|
|
|
<br />
|
|
|
|
<System.CodeBlock>
|
|
|
|
{`import * as React from 'react';
|
|
|
|
import { TabGroup } from 'slate-react-system';`}
|
|
|
|
</System.CodeBlock>
|
|
|
|
<br />
|
|
|
|
<br />
|
2020-06-24 05:02:55 +03:00
|
|
|
<System.H2>Usage</System.H2>
|
|
|
|
<hr />
|
|
|
|
<br />
|
|
|
|
<System.P>Define the tab group values and labels.</System.P>
|
|
|
|
<br />
|
|
|
|
<System.CodeBlock>
|
2020-07-01 10:31:55 +03:00
|
|
|
{`const TAB_GROUP_TWO = [
|
2020-06-24 05:02:55 +03:00
|
|
|
{ value: '1', label: 'Capricorn' },
|
|
|
|
{ value: '2', label: 'Aquarius' },
|
|
|
|
];
|
|
|
|
|
|
|
|
const TAB_GROUP_THREE = [
|
|
|
|
{ value: '1', label: 'Capricorn' },
|
|
|
|
{ value: '2', label: 'Aquarius' },
|
|
|
|
{ value: '3', label: 'Pisces' },
|
|
|
|
];`}
|
|
|
|
</System.CodeBlock>
|
|
|
|
<br />
|
|
|
|
<System.P>Declare the TabGroup component.</System.P>
|
|
|
|
<br />
|
|
|
|
<System.CodeBlock>
|
2020-07-04 08:05:39 +03:00
|
|
|
{`class ExampleOne extends React.Component {
|
|
|
|
state = { exampleOne: '1' }
|
|
|
|
|
|
|
|
_handleChange = (e) => this._handleChange(
|
|
|
|
{ [e.target.name]: e.target.value }
|
|
|
|
)
|
|
|
|
|
|
|
|
render() {
|
|
|
|
return(
|
|
|
|
<TabGroup
|
|
|
|
name="exampleOne"
|
|
|
|
value={this.state.exampleOne}
|
|
|
|
option={TAB_GROUP_TWO}
|
|
|
|
onChange={this._handleChange}
|
|
|
|
/>
|
|
|
|
)
|
|
|
|
}
|
2020-07-03 19:38:44 +03:00
|
|
|
}
|
2020-06-24 05:02:55 +03:00
|
|
|
|
2020-07-04 08:05:39 +03:00
|
|
|
|
|
|
|
class ExampleTwo extends React.Component {
|
|
|
|
state = { exampleTwo: '3' }
|
|
|
|
|
|
|
|
_handleChange = (e) => this._handleChange(
|
|
|
|
{ [e.target.name]: e.target.value }
|
|
|
|
)
|
|
|
|
|
|
|
|
render() {
|
|
|
|
return(
|
|
|
|
<TabGroup
|
|
|
|
name="exampleTwo"
|
|
|
|
value={this.state.exampleTwo}
|
|
|
|
option={TAB_GROUP_THREE}
|
|
|
|
onChange={this._handleChange}
|
|
|
|
/>
|
|
|
|
)
|
|
|
|
}
|
2020-07-03 19:38:44 +03:00
|
|
|
}`}
|
2020-06-24 05:02:55 +03:00
|
|
|
</System.CodeBlock>
|
|
|
|
<br />
|
|
|
|
<br />
|
|
|
|
<System.H2>Output</System.H2>
|
|
|
|
<hr />
|
|
|
|
<br />
|
2020-06-22 14:00:51 +03:00
|
|
|
<System.TabGroup name="eight" options={TAB_GROUP_TWO} value={this.state.eight} onChange={this._handleChange} />
|
|
|
|
<System.TabGroup name="nine" options={TAB_GROUP_THREE} value={this.state.nine} onChange={this._handleChange} />
|
|
|
|
</SystemPage>
|
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|