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.

36 satır
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. }