diff --git a/docs/data/joy/components/drawer/DrawerUsage.js b/docs/data/joy/components/drawer/DrawerUsage.js index 8ac4dbaa3b9757..7e481d8535ce45 100644 --- a/docs/data/joy/components/drawer/DrawerUsage.js +++ b/docs/data/joy/components/drawer/DrawerUsage.js @@ -2,7 +2,6 @@ import * as React from 'react'; import Button from '@mui/joy/Button'; import Box from '@mui/joy/Box'; import Drawer from '@mui/joy/Drawer'; -import ButtonGroup from '@mui/joy/ButtonGroup'; import List from '@mui/joy/List'; import Divider from '@mui/joy/Divider'; import ListItem from '@mui/joy/ListItem'; @@ -13,82 +12,16 @@ import InboxIcon from '@mui/icons-material/MoveToInbox'; import MailIcon from '@mui/icons-material/Mail'; import JoyUsageDemo from 'docs/src/modules/components/JoyUsageDemo'; -function Demo(props) { - const [state, setState] = React.useState({ - top: false, - left: false, - bottom: false, - right: false, - }); +export default function DrawerUsage() { + const [open, setOpen] = React.useState(false); - const toggleDrawer = (anchor, open) => (event) => { + const toggleDrawer = (value) => (event) => { if (event.type === 'keydown' && (event.key === 'Tab' || event.key === 'Shift')) { return; } - setState({ ...state, [anchor]: open }); + setOpen(value); }; - - const list = (anchor) => ( - - - {['Inbox', 'Starred', 'Send email', 'Drafts'].map((text, index) => ( - - - - {index % 2 === 0 ? : } - - {text} - - - ))} - - - - {['All mail', 'Trash', 'Spam'].map((text, index) => ( - - - - {index % 2 === 0 ? : } - - {text} - - - ))} - - - ); - - return ( - - - {['top', 'right', 'bottom', 'left'].map((anchor) => ( - - ))} - - {['top', 'right', 'bottom', 'left'].map((anchor) => ( - - {list(anchor)} - - ))} - - ); -} - -export default function DrawerUsage() { return ( } + renderDemo={(props) => ( + + + + + + {['Inbox', 'Starred', 'Send email', 'Drafts'].map((text, index) => ( + + + + {index === 0 && } + + {text} + + + ))} + + + + {['All mail', 'Trash', 'Spam'].map((text, index) => ( + + + + {index === 0 && } + + {text} + + + ))} + + + + + )} /> ); }