UNPKG

@intuitionrobotics/thunderstorm

Version:
32 lines 1.24 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.Tabs = exports.Tab = void 0; const React = require("react"); class Tab { constructor(title, content) { this.title = title; this.content = content; } } exports.Tab = Tab; class Tabs extends React.Component { constructor(props) { super(props); this.renderTabHandle = (tab, key) => { const selected = tab === this.state.selectedTab; const style = selected ? this.props.selectedStyle : this.props.nonSelectedStyle; return React.createElement("div", { key: key, style: { paddingLeft: 10, paddingRight: 10 } }, React.createElement("span", { className: `clickable`, onClick: () => this.setState({ selectedTab: tab }), style: style }, tab.title)); }; this.state = { selectedTab: this.props.tabs[0] }; } render() { return React.createElement("div", null, React.createElement("div", { className: 'll_h_c', style: { height: 28, justifyContent: "center" } }, this.props.tabs.map(this.renderTabHandle)), this.state.selectedTab.content); } } exports.Tabs = Tabs; //# sourceMappingURL=Tabs.js.map