nifty-wallet/old-ui/app/components/tab-bar.js

39 lines
909 B
JavaScript
Raw Normal View History

2017-11-14 08:04:23 -08:00
const Component = require('react').Component
const h = require('react-hyperscript')
const inherits = require('util').inherits
module.exports = TabBar
inherits(TabBar, Component)
function TabBar () {
Component.call(this)
}
TabBar.prototype.render = function () {
const props = this.props
const state = this.state || {}
const { tabs = [], defaultTab, tabSelected } = props
const { subview = defaultTab } = state
return (
2018-07-26 11:15:51 -07:00
h('.flex-row.space-around', {
2017-11-14 08:04:23 -08:00
style: {
2018-07-26 11:15:51 -07:00
background: '#60269c',
2017-11-14 08:04:23 -08:00
color: '#AEAEAE',
2018-07-26 11:15:51 -07:00
paddingTop: '10px',
minHeight: '45px',
lineHeight: '45px',
2017-11-14 08:04:23 -08:00
},
}, tabs.map((tab) => {
const { key, content } = tab
return h(subview === key ? '.activeForm' : '.inactiveForm.pointer', {
onClick: () => {
this.setState({ subview: key })
tabSelected(key)
},
}, content)
}))
)
}