BetterDiscordApp-rauenzi/src/ui/settings/tabbar.js

66 lines
1.4 KiB
JavaScript
Raw Normal View History

2019-05-30 07:06:17 +02:00
import {React} from "modules";
2019-05-28 23:27:25 +02:00
2019-05-30 07:06:17 +02:00
class V2C_TabBarItem extends React.Component {
2019-05-28 20:19:48 +02:00
constructor(props) {
super(props);
this.setInitialState();
this.onClick = this.onClick.bind(this);
}
setInitialState() {
this.state = {
selected: this.props.selected || false
};
}
render() {
2019-05-30 07:06:17 +02:00
return React.createElement(
2019-05-28 20:19:48 +02:00
"div",
{className: `ui-tab-bar-item${this.props.selected ? " selected" : ""}`, onClick: this.onClick},
this.props.text
);
}
onClick() {
if (this.props.onClick) {
this.props.onClick(this.props.id);
}
}
}
2019-05-30 07:06:17 +02:00
class V2C_TabBarSeparator extends React.Component {
2019-05-28 20:19:48 +02:00
constructor(props) {
super(props);
}
render() {
2019-05-30 07:06:17 +02:00
return React.createElement("div", {className: "ui-tab-bar-separator margin-top-8 margin-bottom-8"});
2019-05-28 20:19:48 +02:00
}
}
2019-05-30 07:06:17 +02:00
class V2C_TabBarHeader extends React.Component {
2019-05-28 20:19:48 +02:00
constructor(props) {
super(props);
}
render() {
2019-05-30 07:06:17 +02:00
return React.createElement(
2019-05-28 20:19:48 +02:00
"div",
{className: "ui-tab-bar-header"},
this.props.text
);
}
}
export default class V2Cs_TabBar {
static get Item() {
return V2C_TabBarItem;
}
static get Header() {
return V2C_TabBarHeader;
}
static get Separator() {
return V2C_TabBarSeparator;
}
}