Não pode escolher mais do que 25 tópicos Os tópicos devem começar com uma letra ou um número, podem incluir traços ('-') e podem ter até 35 caracteres.

63 linhas
1.4 KiB

  1. import PropTypes from 'prop-types';
  2. // material-ui
  3. import { alpha, styled } from '@mui/material/styles';
  4. import { Box } from '@mui/material';
  5. // third-party
  6. import SimpleBar from 'simplebar-react';
  7. import { BrowserView, MobileView } from 'react-device-detect';
  8. // root style
  9. const RootStyle = styled(BrowserView)({
  10. flexGrow: 1,
  11. height: '100%',
  12. overflow: 'hidden'
  13. });
  14. // scroll bar wrapper
  15. const SimpleBarStyle = styled(SimpleBar)(({ theme }) => ({
  16. // maxHeight: '100%',
  17. '& .simplebar-scrollbar': {
  18. '&:before': {
  19. backgroundColor: alpha(theme.palette.grey[500], 0.48)
  20. },
  21. '&.simplebar-visible:before': {
  22. opacity: 1
  23. }
  24. },
  25. '& .simplebar-track.simplebar-vertical': {
  26. width: 10
  27. },
  28. '& .simplebar-track.simplebar-horizontal .simplebar-scrollbar': {
  29. height: 6
  30. },
  31. '& .simplebar-mask': {
  32. zIndex: 'inherit'
  33. }
  34. }));
  35. // ==============================|| SIMPLE SCROLL BAR ||============================== //
  36. export default function SimpleBarScroll({ children, sx, ...other }) {
  37. return (
  38. <>
  39. <RootStyle>
  40. <SimpleBarStyle timeout={500} clickOnTrack={false} sx={sx} {...other}>
  41. {children}
  42. </SimpleBarStyle>
  43. </RootStyle>
  44. <MobileView>
  45. <Box sx={{ overflowX: 'auto', ...sx }} {...other}>
  46. {children}
  47. </Box>
  48. </MobileView>
  49. </>
  50. );
  51. }
  52. SimpleBarScroll.propTypes = {
  53. children: PropTypes.node,
  54. sx: PropTypes.object
  55. };