Вы не можете выбрать более 25 тем Темы должны начинаться с буквы или цифры, могут содержать дефисы(-) и должны содержать не более 35 символов.

BackdropComponent.tsx 742B

12345678910111213141516171819202122232425
  1. import React from 'react';
  2. import { Backdrop, CircularProgress } from '@mui/material';
  3. import { alpha } from '@mui/system';
  4. interface BackdropComponentProps {
  5. position: 'absolute' | 'fixed';
  6. isLoading: boolean;
  7. }
  8. const BackdropComponent: React.FC<BackdropComponentProps> = ({ position = 'fixed', isLoading }) => (
  9. <Backdrop
  10. sx={{
  11. // 'fixed' takes whole page, 'absolute' takes whole space of the parent element which needs to have 'relative' position
  12. position,
  13. backgroundColor: ({ palette }) =>
  14. alpha(palette.background.default, palette.action.disabledOpacity),
  15. zIndex: ({ zIndex }) => zIndex.drawer + 1,
  16. }}
  17. open={isLoading}
  18. >
  19. <CircularProgress />
  20. </Backdrop>
  21. );
  22. export default BackdropComponent;