You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

CustomBackdrop.js 761B

1234567891011121314151617181920212223242526
  1. import React from 'react';
  2. import PropTypes from 'prop-types';
  3. import { Backdrop, CircularProgress } from '@mui/material';
  4. import { alpha } from '@mui/system';
  5. const CustomBackdrop = ({ position = 'fixed', isLoading }) => (
  6. <Backdrop
  7. sx={{
  8. // 'fixed' takes whole page, 'fixed' takes whole space of the parent element which needs to have 'relative' position
  9. position,
  10. backgroundColor: ({ palette }) =>
  11. alpha(palette.background.default, palette.action.disabledOpacity),
  12. zIndex: ({ zIndex }) => zIndex.drawer + 1,
  13. }}
  14. open={isLoading}
  15. >
  16. <CircularProgress />
  17. </Backdrop>
  18. );
  19. CustomBackdrop.propTypes = {
  20. position: PropTypes.oneOf(['fixed', 'absolute']),
  21. isLoading: PropTypes.bool.isRequired,
  22. };
  23. export default CustomBackdrop;