import * as React from 'react'; import Box from '@mui/joy/Box'; import Drawer from '@mui/joy/Drawer'; import ButtonGroup from '@mui/joy/ButtonGroup'; import Button from '@mui/joy/Button'; import List from '@mui/joy/List'; import Divider from '@mui/joy/Divider'; import ListItem from '@mui/joy/ListItem'; import ListItemButton from '@mui/joy/ListItemButton'; type Anchor = 'top' | 'left' | 'bottom' | 'right'; export default function DrawerAnchor() { const [state, setState] = React.useState({ top: false, left: false, bottom: false, right: false, }); const toggleDrawer = (anchor: Anchor, open: boolean) => (event: React.KeyboardEvent | React.MouseEvent) => { if ( event.type === 'keydown' && ((event as React.KeyboardEvent).key === 'Tab' || (event as React.KeyboardEvent).key === 'Shift') ) { return; } setState({ ...state, [anchor]: open }); }; const list = (anchor: Anchor) => ( {['Inbox', 'Starred', 'Send email', 'Drafts'].map((text) => ( {text} ))} {['All mail', 'Trash', 'Spam'].map((text) => ( {text} ))} ); return ( {(['top', 'right', 'bottom', 'left'] as const).map((anchor) => ( ))} {(['top', 'right', 'bottom', 'left'] as const).map((anchor) => ( {list(anchor)} ))} ); }