import { styled } from '@mui/material/styles' import MuiAppBar, { AppBarProps as MuiAppBarProps } from '@mui/material/AppBar' import Toolbar from '@mui/material/Toolbar' import Typography from '@mui/material/Typography' import StepIcon from '@mui/material/StepIcon' import Tooltip from '@mui/material/Tooltip' import IconButton from '@mui/material/IconButton' import MenuIcon from '@mui/icons-material/Menu' import LinkIcon from '@mui/icons-material/Link' import { drawerWidth } from './Drawer' import { peerListWidth } from './PeerList' interface AppBarProps extends MuiAppBarProps { isDrawerOpen?: boolean isPeerListOpen?: boolean } export const AppBar = styled(MuiAppBar, { shouldForwardProp: prop => prop !== 'isDrawerOpen' && prop !== 'isPeerListOpen', })(({ theme, isDrawerOpen, isPeerListOpen }) => ({ transition: theme.transitions.create(['margin', 'width'], { easing: theme.transitions.easing.sharp, duration: theme.transitions.duration.leavingScreen, }), ...(isDrawerOpen && { width: `calc(100% - ${drawerWidth}px)`, marginLeft: `${drawerWidth}px`, transition: theme.transitions.create(['margin', 'width'], { easing: theme.transitions.easing.easeOut, duration: theme.transitions.duration.enteringScreen, }), }), ...(isPeerListOpen && { width: `calc(100% - ${peerListWidth}px)`, marginRight: `${peerListWidth}px`, transition: theme.transitions.create(['margin', 'width'], { easing: theme.transitions.easing.easeOut, duration: theme.transitions.duration.enteringScreen, }), }), })) interface ShellAppBarProps { doShowPeers: boolean onDrawerOpen: () => void onLinkButtonClick: () => Promise isDrawerOpen: boolean isPeerListOpen: boolean numberOfPeers: number title: string onPeerListClick: () => void } export const ShellAppBar = ({ doShowPeers, onDrawerOpen, onLinkButtonClick, isDrawerOpen, isPeerListOpen, numberOfPeers, title, onPeerListClick, }: ShellAppBarProps) => { return ( {title} {doShowPeers ? ( ) : null} ) }