Vous ne pouvez pas sélectionner plus de 25 sujets Les noms de sujets doivent commencer par une lettre ou un nombre, peuvent contenir des tirets ('-') et peuvent comporter jusqu'à 35 caractères.

36 lignes
946B

  1. import { Backdrop, CircularProgress, useTheme } from "@mui/material";
  2. import { createContext, useState } from "react";
  3. type Props = {
  4. children: React.ReactNode;
  5. };
  6. type ContextProps = {
  7. showBackDrop: boolean;
  8. setShowBackDrop: (show: boolean) => void;
  9. };
  10. const defaultProps: ContextProps = {
  11. showBackDrop: false,
  12. setShowBackDrop: (show: boolean) => {},
  13. };
  14. export const BackDroptContext = createContext<ContextProps>(defaultProps);
  15. export default function BackDropContextProvider({ children }: Props) {
  16. const [showBackDrop, setShowBackDrop] = useState(false);
  17. return (
  18. <BackDroptContext.Provider value={{ showBackDrop, setShowBackDrop }}>
  19. {children}
  20. <Backdrop
  21. open={showBackDrop}
  22. sx={{
  23. // display: 'frex',
  24. zIndex: 9999,
  25. opacity: "0.3 !important",
  26. }}
  27. >
  28. <CircularProgress color="inherit" />
  29. </Backdrop>
  30. </BackDroptContext.Provider>
  31. );
  32. }