| | |
| |
|
| | import * as React from "react"; |
| | import { Container, Site, Notification, AccountDropdown } from "../"; |
| | import type { Props as NotificationTrayProps } from "../Notification/NotificationTray.react"; |
| | import type { Props as AccountDropdownProps } from "../AccountDropdown/AccountDropdown.react"; |
| |
|
| | export type Props = {| |
| | +children?: React.Node, |
| | |
| | |
| | |
| | +align?: string, |
| | |
| | |
| | |
| | +href?: string, |
| | |
| | |
| | |
| | +imageURL?: string, |
| | |
| | |
| | |
| | +alt?: string, |
| | |
| | |
| | |
| | +notificationsTray?: NotificationTrayProps, |
| | +accountDropdown?: AccountDropdownProps, |
| | +navItems?: React.Node, |
| | |
| | |
| | |
| | +onMenuToggleClick?: () => void, |
| | |}; |
| |
|
| | |
| | |
| | |
| | |
| | const SiteHeader = ({ |
| | children, |
| | href, |
| | align, |
| | imageURL, |
| | alt, |
| | notificationsTray: notificationsTrayFromProps, |
| | accountDropdown: accountDropdownFromProps, |
| | navItems, |
| | onMenuToggleClick, |
| | }: Props): React.Node => { |
| | const notificationsTray = |
| | notificationsTrayFromProps && |
| | React.createElement(Notification.Tray, notificationsTrayFromProps); |
| |
|
| | const accountDropdown = |
| | accountDropdownFromProps && |
| | React.createElement(AccountDropdown, accountDropdownFromProps); |
| |
|
| | return ( |
| | <div className="header py-4"> |
| | <Container className={align}> |
| | <div className="d-flex"> |
| | {children || ( |
| | <React.Fragment> |
| | <Site.Logo href={href} alt={alt} src={imageURL} /> |
| | <div className="d-flex order-lg-2 ml-auto"> |
| | {navItems} |
| | {notificationsTray} |
| | {accountDropdown} |
| | </div> |
| | <a |
| | className="header-toggler d-lg-none ml-3 ml-lg-0" |
| | onClick={onMenuToggleClick} |
| | > |
| | <span className="header-toggler-icon" /> |
| | </a> |
| | </React.Fragment> |
| | )} |
| | </div> |
| | </Container> |
| | </div> |
| | ); |
| | }; |
| |
|
| | SiteHeader.displayName = "Site.Header"; |
| |
|
| | export default SiteHeader; |
| |
|