react-toolbox/components/tabs/TabContent.js

40 lines
945 B
JavaScript
Raw Normal View History

import React, { Component } from 'react';
import PropTypes from 'prop-types';
2016-05-26 22:01:54 +03:00
import classnames from 'classnames';
import { themr } from 'react-css-themr';
2017-01-26 20:05:32 +03:00
import { TABS } from '../identifiers';
2015-11-13 03:01:27 +03:00
2016-05-31 00:23:55 +03:00
class TabContent extends Component {
2015-11-13 03:01:27 +03:00
static propTypes = {
2016-05-31 00:23:55 +03:00
active: PropTypes.bool,
children: PropTypes.node,
className: PropTypes.string,
hidden: PropTypes.bool,
2016-05-31 00:23:55 +03:00
theme: PropTypes.shape({
active: PropTypes.string,
2017-01-26 20:05:32 +03:00
tab: PropTypes.string,
}),
2015-11-13 03:01:27 +03:00
};
static defaultProps = {
active: false,
2017-01-26 20:05:32 +03:00
className: '',
hidden: true,
2015-11-13 03:01:27 +03:00
};
2017-01-26 20:05:32 +03:00
render() {
2016-05-26 22:01:54 +03:00
const className = classnames(this.props.theme.tab, {
2017-01-26 20:05:32 +03:00
[this.props.theme.active]: this.props.active,
2016-05-26 22:01:54 +03:00
}, this.props.className);
2015-11-13 03:01:27 +03:00
return (
<section className={className} role="tabpanel" aria-expanded={this.props.hidden}>
2015-11-13 03:01:27 +03:00
{this.props.children}
</section>
);
}
}
2016-05-31 00:23:55 +03:00
export default themr(TABS)(TabContent);
export { TabContent };