UNPKG

d2-ui

Version:
55 lines (51 loc) 1.78 kB
import React, { PropTypes } from 'react'; import ProfileMenu from './menus/ProfileMenu'; import InnerHeader from './InnerHeader'; import HeaderMenus from './menus/HeaderMenus'; import SearchField from './search/SearchField'; import styles, { applyUserStyle } from './header-bar-styles'; import LinearProgress from 'material-ui/LinearProgress'; export default function HeaderBar(props, _ref) { var d2 = _ref.d2; var appItems = props.appItems; var profileItems = props.profileItems; var currentUser = props.currentUser; var settings = props.settings; var noLoadingIndicator = props.noLoadingIndicator; // If the required props are not passed we're in a loading state. if (!appItems && !profileItems && !settings) { if (noLoadingIndicator) { return React.createElement('div', { style: { display: 'none' } }); } return React.createElement( 'div', { style: styles.headerBar }, React.createElement(LinearProgress, { mode: 'indeterminate' }) ); } return React.createElement( 'div', { style: applyUserStyle(d2.currentUser, styles.headerBar) }, React.createElement(InnerHeader, null), React.createElement(SearchField, null), React.createElement( HeaderMenus, null, React.createElement(ProfileMenu, { items: profileItems, rowItemCount: 3, columnItemCount: 3, currentUser: currentUser }) ) ); } HeaderBar.contextTypes = { d2: PropTypes.object }; HeaderBar.propTypes = { appItems: PropTypes.array, profileItems: PropTypes.array, currentUser: PropTypes.object, settings: PropTypes.object };