import ImmutablePropTypes from 'react-immutable-proptypes' import ImmutablePureComponent from 'react-immutable-pure-component' import { BREAKPOINT_EXTRA_SMALL } from '../constants' import { me } from '../initial_state' import { makeGetAccount } from '../selectors' import Responsive from '../features/ui/util/responsive_component' import ResponsiveClassesComponent from '../features/ui/util/responsive_classes_component' import { CX } from '../constants' import Avatar from './avatar' import Button from './button' import Heading from './heading' import Icon from './icon' import Search from './search' import Text from './text' const mapStateToProps = (state) => ({ account: makeGetAccount()(state, me), }) export default @connect(mapStateToProps) class NavigationBar extends ImmutablePureComponent { static contextTypes = { router: PropTypes.object, } static propTypes = { account: ImmutablePropTypes.map, actions: PropTypes.array, tabs: PropTypes.array, title: PropTypes.string, showBackBtn: PropTypes.bool, } historyBack = () => { if (window.history && window.history.length === 1) { this.context.router.history.push('/home') } else { this.context.router.history.goBack() } } handleBackClick = () => { this.historyBack() } handleProfileClick = () => { } render() { const { title, showBackBtn, actions, tabs, account, } = this.props return (
{ /** Default */}

{ !!account && }
{ /** Mobile */}
{ !!account && !showBackBtn && } { showBackBtn &&
{title}
{ !!actions &&
{ actions.map((action, i) => (
}
) } } class NavigationBarButtonDivider extends PureComponent { render() { return (
) } } class NavigationBarButton extends PureComponent { static propTypes = { title: PropTypes.string, icon: PropTypes.string, to: PropTypes.string, href: PropTypes.string, attrTitle: PropTypes.string, } render() { const { title, icon, to, href, attrTitle, } = this.props const active = false const classes = CX({ default: 1, height53PX: 1, flexRow: 1, alignItemsCenter: 1, justifyContentCenter: 1, outlineNone: 1, cursorPointer: 1, bgTransparent: 1, noUnderline: 1, colorNavigation: 1, px10: !!title, px5: !title, colorWhite: !!title, fs13PX: !!title, fontWeightNormal: !!title, textUppercase: !!title, }) const iconClasses = CX({ fillNavigation: !!title || active, fillNavigationBlend: !title, mr10: !!title, }) const iconSize = !!title ? '16px' : '18px' return ( ) } }