aboutsummaryrefslogtreecommitdiff
path: root/diplomacy/web/src/gui/core/tab.jsx
blob: f1ad4aa5ba8552d4c20aeafe832372ae671231ba (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
import React from "react";
import PropTypes from "prop-types";

export class Tab extends React.Component {
    render() {
        const style = {
            display: this.props.display ? 'block' : 'none'
        };
        const id = this.props.id ? {id: this.props.id} : {};
        return (
            <div className={'tab mb-4 ' + this.props.className} style={style} {...id}>
                {this.props.children}
            </div>
        );
    }
}

Tab.propTypes = {
    display: PropTypes.bool,
    className: PropTypes.string,
    id: PropTypes.string,
    children: PropTypes.oneOfType([PropTypes.array, PropTypes.object])
};

Tab.defaultProps = {
    display: false,
    className: '',
    id: ''
};