import React from 'react'; import PropTypes from 'prop-types'; import { useIntl } from '@edx/frontend-platform/i18n'; import classNames from 'classnames'; import { ActionRow, Button, Container, Icon, IconButton, Nav, Row, } from '@openedx/paragon'; import { Close, MenuIcon, Search } from '@openedx/paragon/icons'; import CourseLockUp from './CourseLockUp'; import UserMenu from './UserMenu'; import BrandNav from './BrandNav'; import NavDropdownMenu from './NavDropdownMenu'; import messages from './messages'; const HeaderBody = ({ logo, logoAltText, number, org, title, username, isAdmin, studioBaseUrl, logoutUrl, authenticatedUserAvatar, isMobile, setModalPopupTarget, toggleModalPopup, isModalPopupOpen, isHiddenMainMenu, mainMenuDropdowns, outlineLink, searchButtonAction, containerProps, }) => { const intl = useIntl(); const renderBrandNav = ( ); const { className: containerClassName, ...restContainerProps } = containerProps || {}; return ( {isHiddenMainMenu ? ( {renderBrandNav} ) : ( <> {isMobile ? ( ) : (
{renderBrandNav}
)} {isMobile ? ( <> {renderBrandNav} ) : ( )} )} {searchButtonAction && ( )}
); }; HeaderBody.propTypes = { studioBaseUrl: PropTypes.string.isRequired, logoutUrl: PropTypes.string.isRequired, setModalPopupTarget: PropTypes.func, toggleModalPopup: PropTypes.func, isModalPopupOpen: PropTypes.bool, number: PropTypes.string, org: PropTypes.string, title: PropTypes.string, logo: PropTypes.string, logoAltText: PropTypes.string, authenticatedUserAvatar: PropTypes.string, username: PropTypes.string, isAdmin: PropTypes.bool, isMobile: PropTypes.bool, isHiddenMainMenu: PropTypes.bool, mainMenuDropdowns: PropTypes.arrayOf(PropTypes.shape({ id: PropTypes.string, buttonTitle: PropTypes.node, items: PropTypes.arrayOf(PropTypes.shape({ href: PropTypes.string, title: PropTypes.node, })), })), outlineLink: PropTypes.string, searchButtonAction: PropTypes.func, containerProps: PropTypes.shape(Container.propTypes), }; HeaderBody.defaultProps = { setModalPopupTarget: null, toggleModalPopup: null, isModalPopupOpen: false, logo: null, logoAltText: null, number: '', org: '', title: '', authenticatedUserAvatar: null, username: null, isAdmin: false, isMobile: false, isHiddenMainMenu: false, mainMenuDropdowns: [], outlineLink: null, searchButtonAction: null, containerProps: {}, }; export default HeaderBody;