react-toolbox/spec/components/tabs.js

74 lines
2.8 KiB
JavaScript
Raw Normal View History

import React from 'react';
2015-10-11 23:27:59 +03:00
import { Tabs, Tab } from '../../components/tabs';
2015-09-21 11:01:52 +03:00
2015-11-11 05:09:08 +03:00
class TabsTest extends React.Component {
state = {
index: 1,
fixedIndex: 1,
2017-01-26 20:05:32 +03:00
inverseIndex: 1,
2015-11-11 05:09:08 +03:00
};
2015-11-13 12:04:08 +03:00
handleTabChange = (index) => {
2017-01-26 20:05:32 +03:00
this.setState({ index });
2015-11-13 03:01:27 +03:00
};
handleFixedTabChange = (index) => {
2017-01-26 20:05:32 +03:00
this.setState({ fixedIndex: index });
};
handleInverseTabChange = (index) => {
2017-01-26 20:05:32 +03:00
this.setState({ inverseIndex: index });
};
2015-11-13 03:01:27 +03:00
handleActive = () => {
2015-11-13 12:04:08 +03:00
console.log('Special one activated');
2015-11-11 05:09:08 +03:00
};
2017-01-26 20:05:32 +03:00
render() {
2015-11-11 05:09:08 +03:00
return (
<section>
<h5>Tabs</h5>
<p>This tabs can be disabled or hidden</p>
<Tabs disableAnimatedBottomBorder index={this.state.index} onChange={this.handleTabChange}>
2017-01-26 20:05:32 +03:00
<Tab ripple={false} label="Primary"><small>Primary content (no ripple)</small></Tab>
<Tab label="Secondary" onActive={this.handleActive}><small>Secondary content</small></Tab>
<Tab label="Third" disabled><small>Disabled content</small></Tab>
<Tab label="Fourth" hidden><small>Fourth content hidden</small></Tab>
<Tab label="Fifth"><small>Fifth content</small></Tab>
2015-11-11 05:09:08 +03:00
</Tabs>
<h5>Fixed Tabs</h5>
<p>These tabs fill the given space.</p>
<Tabs index={this.state.fixedIndex} onChange={this.handleFixedTabChange} fixed>
2017-01-26 20:05:32 +03:00
<Tab label="First"><small>First Content</small></Tab>
<Tab label="Second"><small>Second Content</small></Tab>
<Tab label="Third"><small>Third Content</small></Tab>
<Tab label="Fourth"><small>Fourth Content</small></Tab>
<Tab label="Fifth"><small>Fifth Content</small></Tab>
</Tabs>
<h5>Inverse Tabs</h5>
<p>These tabs have an inverted theme.</p>
<Tabs index={this.state.inverseIndex} onChange={this.handleInverseTabChange} inverse>
2017-01-26 20:05:32 +03:00
<Tab label="First"><small>First Content</small></Tab>
<Tab label="Second"><small>Second Content</small></Tab>
<Tab label="Third"><small>Third Content</small></Tab>
<Tab label="Disabled" disabled><small>Disabled Content</small></Tab>
</Tabs>
<h5>Inverse Tabs with labels and icons</h5>
<Tabs index={this.state.inverseIndex} onChange={this.handleInverseTabChange} inverse>
2017-01-26 20:05:32 +03:00
<Tab label="Home" icon="home"><small>First Content</small></Tab>
<Tab label="Favorite" icon="favorite"><small>Second Content</small></Tab>
<Tab label="Call" icon="call"><small>Third Content</small></Tab>
</Tabs>
<h5>Inverse Tabs with icons</h5>
<Tabs index={this.state.inverseIndex} onChange={this.handleInverseTabChange} inverse>
2017-01-26 20:05:32 +03:00
<Tab icon="home"><small>First Content</small></Tab>
<Tab icon="favorite"><small>Second Content</small></Tab>
<Tab icon="call"><small>Third Content</small></Tab>
</Tabs>
2015-11-11 05:09:08 +03:00
</section>
);
}
}
2015-10-11 23:27:59 +03:00
export default TabsTest;