Some checks failed
No response / noResponse (push) Has been cancelled
CI / Continuous releases (push) Has been cancelled
CI / test-dev (macos-latest) (push) Has been cancelled
CI / test-dev (ubuntu-latest) (push) Has been cancelled
CI / test-dev (windows-latest) (push) Has been cancelled
Maintenance / main (push) Has been cancelled
Scorecards supply-chain security / Scorecards analysis (push) Has been cancelled
CodeQL / Analyze (push) Has been cancelled
73 lines
1.9 KiB
JavaScript
73 lines
1.9 KiB
JavaScript
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';
|
|
|
|
export default function DrawerAnchor() {
|
|
const [state, setState] = React.useState({
|
|
top: false,
|
|
left: false,
|
|
bottom: false,
|
|
right: false,
|
|
});
|
|
|
|
const toggleDrawer = (anchor, open) => (event) => {
|
|
if (event.type === 'keydown' && (event.key === 'Tab' || event.key === 'Shift')) {
|
|
return;
|
|
}
|
|
|
|
setState({ ...state, [anchor]: open });
|
|
};
|
|
|
|
const list = (anchor) => (
|
|
<Box
|
|
role="presentation"
|
|
onClick={toggleDrawer(anchor, false)}
|
|
onKeyDown={toggleDrawer(anchor, false)}
|
|
>
|
|
<List>
|
|
{['Inbox', 'Starred', 'Send email', 'Drafts'].map((text) => (
|
|
<ListItem key={text}>
|
|
<ListItemButton>{text}</ListItemButton>
|
|
</ListItem>
|
|
))}
|
|
</List>
|
|
<Divider />
|
|
<List>
|
|
{['All mail', 'Trash', 'Spam'].map((text) => (
|
|
<ListItem key={text}>
|
|
<ListItemButton>{text}</ListItemButton>
|
|
</ListItem>
|
|
))}
|
|
</List>
|
|
</Box>
|
|
);
|
|
|
|
return (
|
|
<React.Fragment>
|
|
<ButtonGroup variant="outlined">
|
|
{['top', 'right', 'bottom', 'left'].map((anchor) => (
|
|
<Button key={anchor} onClick={toggleDrawer(anchor, true)}>
|
|
{anchor}
|
|
</Button>
|
|
))}
|
|
</ButtonGroup>
|
|
{['top', 'right', 'bottom', 'left'].map((anchor) => (
|
|
<Drawer
|
|
key={anchor}
|
|
anchor={anchor}
|
|
open={state[anchor]}
|
|
onClose={toggleDrawer(anchor, false)}
|
|
>
|
|
{list(anchor)}
|
|
</Drawer>
|
|
))}
|
|
</React.Fragment>
|
|
);
|
|
}
|