import React from 'react'; import PropTypes from 'prop-types'; import { useTranslation } from 'react-i18next'; import classNames from 'classnames'; // TODO: This may fail if package is split from PWA build import { useHistory } from 'react-router-dom'; import { NavBar, Svg, Icon, IconButton, Dropdown } from '@ohif/ui'; function Header({ children, menuOptions, isReturnEnabled }) { const { t } = useTranslation(); const history = useHistory(); const onReturnHandler = () => { if (isReturnEnabled) { history.push('/'); } }; return (
{/* // TODO: Should preserve filter/sort // Either injected service? Or context (like react router's `useLocation`?) */}
{isReturnEnabled && }
{children}
{t('Header:INVESTIGATIONAL USE ONLY')}
); } Header.propTypes = { children: PropTypes.oneOfType([PropTypes.node, PropTypes.func]), isReturnEnabled: PropTypes.bool }; Header.defaultProps = { isReturnEnabled: true }; export default Header;