import { Drawer, DrawerContent, DrawerContentBody, DrawerProps } from '../Drawer'; import styles from '@patternfly/react-styles/css/components/Compass/compass'; import { css } from '@patternfly/react-styles'; export interface CompassProps extends React.HTMLProps { /** Additional classes added to the Compass. */ className?: string; /** The horizontal masthead content (e.g. ). This masthead will only render when dock content is passed and only at mobile viewports. */ masthead?: React.ReactNode; /** Content of the docked navigation area of the layout */ dock?: React.ReactNode; /** @beta Flag indicating the docked nav is expanded on mobile. Only applies when dock content is passed. */ isDockExpanded?: boolean; /** @beta Flag indicating the docked nav should display text on desktop. Only applies when dock content is passed, and * will handle toggling the visibility of the text in individual isDocked components. */ isDockTextExpanded?: boolean; /** Content placed at the top of the compass layout */ header?: React.ReactNode; /** Flag indicating if the header is expanded */ isHeaderExpanded?: boolean; /** Content placed at the horizontal start of the layout, before the main content */ sidebarStart?: React.ReactNode; /** Flag indicating if the start sidebar is expanded */ isSidebarStartExpanded?: boolean; /** Content placed at the center of the layout */ main?: React.ReactNode; /** Content placed at the horizontal end of the layout, after the main content */ sidebarEnd?: React.ReactNode; /** Flag indicating if the end sidebar is expanded */ isSidebarEndExpanded?: boolean; /** Content placed at the bottom of the layout */ footer?: React.ReactNode; /** Flag indicating if the footer is expanded */ isFooterExpanded?: boolean; /** Content rendered in an optional drawer wrapping the layout */ drawerContent?: React.ReactNode; /** Additional props passed to the drawer */ drawerProps?: DrawerProps; } export const Compass: React.FunctionComponent = ({ className, masthead, dock, isDockExpanded, isDockTextExpanded, header, isHeaderExpanded = true, sidebarStart, isSidebarStartExpanded = true, main, sidebarEnd, isSidebarEndExpanded = true, footer, isFooterExpanded = true, drawerContent, drawerProps, ...props }: CompassProps) => { const hasDrawer = drawerContent !== undefined; const compassContent = (
{dock && masthead} {dock && (
{dock}
)} {header && (
{header}
)} {sidebarStart && (
{sidebarStart}
)} {main &&
{main}
} {sidebarEnd && (
{sidebarEnd}
)} {footer && (
{footer}
)}
); return (
{hasDrawer ? ( {compassContent} ) : ( compassContent )}
); }; Compass.displayName = 'Compass';