import React from 'react'; import { NavItem, Collapse } from 'react-bootstrap'; import Fa from './fa'; import './command-bar.less'; export default class CommandBar extends React.Component { constructor(props) { super(props); this.clickItem = this.clickItem.bind(this); } componentWillMount() { this.state = { show: true }; } clickItem(item) { return () => { if (item.onClick) { item.onClick(item); } else { this.setState({ item: item === this.state.item ? null : item }); } }; } renderItem(item, index) { if (item.node) { return item.node; } // if empty should not return null if (item.visible === false) { return null; } return (
  • {item.title} { item.submenu && }
  • ); } render() { const cmds = this.props.commands; if (!cmds) { return null; } return ( ); } } CommandBar.propTypes = { commands: React.PropTypes.array };