diff options
author | kumavis <kumavis@users.noreply.github.com> | 2018-04-10 04:56:59 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-04-10 04:56:59 +0800 |
commit | df1f891585dc41a7d725d592902a84e432e66dc4 (patch) | |
tree | e450c931e8d6d4a1277fd57e330fa8882d7cc93f /ui/app/components/tab-bar.js | |
parent | 931ce120737210cbbf6736b454580ac0610f527a (diff) | |
parent | 305f5f0034f347ee3eacbc4e6ef41817c1de9ab2 (diff) | |
download | tangerine-wallet-browser-df1f891585dc41a7d725d592902a84e432e66dc4.tar.gz tangerine-wallet-browser-df1f891585dc41a7d725d592902a84e432e66dc4.tar.zst tangerine-wallet-browser-df1f891585dc41a7d725d592902a84e432e66dc4.zip |
Merge branch 'master' into i3621-LogoPerformance
Diffstat (limited to 'ui/app/components/tab-bar.js')
-rw-r--r-- | ui/app/components/tab-bar.js | 26 |
1 files changed, 6 insertions, 20 deletions
diff --git a/ui/app/components/tab-bar.js b/ui/app/components/tab-bar.js index a80640116..0016a09c1 100644 --- a/ui/app/components/tab-bar.js +++ b/ui/app/components/tab-bar.js @@ -4,31 +4,17 @@ const PropTypes = require('prop-types') const classnames = require('classnames') class TabBar extends Component { - constructor (props) { - super(props) - const { defaultTab, tabs } = props - - this.state = { - subview: defaultTab || tabs[0].key, - } - } - render () { - const { tabs = [], tabSelected } = this.props - const { subview } = this.state + const { tabs = [], onSelect, isActive } = this.props return ( h('.tab-bar', {}, [ - tabs.map((tab) => { - const { key, content } = tab + tabs.map(({ key, content }) => { return h('div', { className: classnames('tab-bar__tab pointer', { - 'tab-bar__tab--active': subview === key, + 'tab-bar__tab--active': isActive(key, content), }), - onClick: () => { - this.setState({ subview: key }) - tabSelected(key) - }, + onClick: () => onSelect(key), key, }, content) }), @@ -39,9 +25,9 @@ class TabBar extends Component { } TabBar.propTypes = { - defaultTab: PropTypes.string, + isActive: PropTypes.func.isRequired, tabs: PropTypes.array, - tabSelected: PropTypes.func, + onSelect: PropTypes.func, } module.exports = TabBar |