import React from 'react'; import { browserHistory, Link } from 'react-router'; import Helmet from 'react-helmet'; import { observer, inject } from 'mobx-react'; import keydown from 'react-keydown'; import _ from 'lodash'; import DropdownMenu, { MenuItem } from 'components/DropdownMenu'; import { Flex } from 'reflexbox'; import LoadingIndicator from 'components/LoadingIndicator'; import Alert from 'components/Alert'; import { Avatar } from 'rebass'; import styles from './Layout.scss'; import classNames from 'classnames/bind'; const cx = classNames.bind(styles); @inject('user') @observer class Layout extends React.Component { static propTypes = { children: React.PropTypes.node, actions: React.PropTypes.node, title: React.PropTypes.node, titleText: React.PropTypes.node, loading: React.PropTypes.bool, user: React.PropTypes.object.isRequired, search: React.PropTypes.bool, notifications: React.PropTypes.node, }; static defaultProps = { search: true, }; @keydown(['/', 't']) search() { // if (!this.props.user) return; _.defer(() => browserHistory.push('/search')); } @keydown(['d']) dashboard() { // if (!this.props.user) return; _.defer(() => browserHistory.push('/')); } render() { const user = this.props.user; return (
{this.props.loading && } {this.props.notifications}
Atlas {this.props.title}
{this.props.actions} {user.user && {this.props.search &&
Search
} } > Settings Keyboard shortcuts API Logout
}
{this.props.children}
); } } export default Layout;