import * as React from 'react'; import Toolbar from '@mui/material/Toolbar'; import Typography from '@mui/material/Typography'; import Box from '@mui/material/Box'; import MuiAppBar, { AppBarProps as MuiAppBarProps } from '@mui/material/AppBar'; import { styled } from '@mui/material/styles'; import HelpOutlineOutlinedIcon from '@mui/icons-material/HelpOutlineOutlined'; import KOSMenuButton from './KOSMenuButton'; import KOSClientClock from './KOSClientClock'; import KOSAccountMenu from './KOSAccountMenu'; import IconButton from '@mui/material/IconButton'; import Tooltip from '@mui/material/Tooltip'; interface AppBarProps extends MuiAppBarProps { open?: boolean; } const DRAWER_WIDTH = 240; const AppBar = styled(MuiAppBar, { shouldForwardProp: (prop) => prop !== 'open', })(({ theme, open }) => ({ zIndex: theme.zIndex.drawer + 1, transition: theme.transitions.create(['width', 'margin'], { easing: theme.transitions.easing.sharp, duration: theme.transitions.duration.leavingScreen, }), ...(open && { marginLeft: DRAWER_WIDTH, width: `calc(100% - ${DRAWER_WIDTH}px)`, transition: theme.transitions.create(['width', 'margin'], { easing: theme.transitions.easing.sharp, duration: theme.transitions.duration.enteringScreen, }), }), })); export interface KOSTopbarProps { title: string; isDevelopment?: boolean; openMenu?: boolean; searchComponent?: React.ReactNode; helpCenterLink?: string; flexRightArea?: number; signOutText?: string; username?: string; avatarUrl?: string; onOpenMenuClick?: () => void; onLogoutClick?: () => void; } const KOSTopbar = (props: KOSTopbarProps) => { const { isDevelopment, openMenu, title, searchComponent, flexRightArea, helpCenterLink, onOpenMenuClick, onLogoutClick, signOutText, username, avatarUrl, } = props; const handleOpenMenuClick = () => { if (onOpenMenuClick) { onOpenMenuClick(); } }; return ( {/* Left area */} {openMenu !== undefined && ( )} Foodology logo {/* Center area */} {isDevelopment && ( 🧬 )} {title} {/* Right area */} {searchComponent !== undefined && {searchComponent}} {helpCenterLink !== undefined && ( )} ); }; export default KOSTopbar;