import React, { PropTypes } from 'react' import ReactDOM from 'react-dom' import { connect } from 'react-redux' import ConfigTab from './ConfigTab' import InfoTab from './InfoTab' import StoragesTab from './StoragesTab' import CSSModules from 'browser/lib/CSSModules' import styles from './PreferencesModal.styl' class Preferences extends React.Component { constructor (props) { super(props) this.state = { currentTab: 'STORAGES' } } componentDidMount () { this.refs.root.focus() const boundingBox = this.getContentBoundingBox() this.setState({ boundingBox }) } switchTeam (teamId) { this.setState({currentTeamId: teamId}) } handleNavButtonClick (tab) { return (e) => { this.setState({currentTab: tab}) } } renderContent () { const { boundingBox } = this.state let { dispatch, config, data } = this.props switch (this.state.currentTab) { case 'INFO': return case 'CONFIG': return ( ) case 'STORAGES': default: return ( ) } } handleKeyDown (e) { if (e.keyCode === 27) { this.props.close() } } getContentBoundingBox () { const node = ReactDOM.findDOMNode(this.refs.content) return node.getBoundingClientRect() } render () { let content = this.renderContent() let tabs = [ {target: 'STORAGES', label: 'Storages', icon: 'database'}, {target: 'CONFIG', label: 'Config', icon: 'cogs'}, {target: 'INFO', label: 'Info', icon: 'info-circle'} ] let navButtons = tabs.map((tab) => { let isActive = this.state.currentTab === tab.target return ( ) }) return (
this.handleKeyDown(e)} >

Your menu for Boostnote

{navButtons}
{content}
) } } Preferences.propTypes = { dispatch: PropTypes.func } export default connect((x) => x)(CSSModules(Preferences, styles))