選択できるのは25トピックまでです。 トピックは、先頭が英数字で、英数字とダッシュ('-')を使用した35文字以内のものにしてください。

DrawerComponent.js 582B

12345678910111213141516171819202122232425262728
  1. import React from 'react';
  2. import PropTypes from 'prop-types';
  3. import { Drawer } from '@mui/material';
  4. const DrawerComponent = ({ open, toggleOpen, content, anchor = 'right' }) => (
  5. <Drawer
  6. sx={{
  7. minWidth: 250,
  8. '& .MuiDrawer-paper': {
  9. minWidth: 250,
  10. },
  11. }}
  12. anchor={anchor}
  13. open={open}
  14. onClose={toggleOpen}
  15. >
  16. {content ? content : null}
  17. </Drawer>
  18. );
  19. DrawerComponent.propTypes = {
  20. open: PropTypes.bool,
  21. toggleOpen: PropTypes.func,
  22. content: PropTypes.any,
  23. anchor: PropTypes.oneOf(['top', 'right', 'left', 'bottom']),
  24. };
  25. export default DrawerComponent;