25 lines
No EOL
693 B
TypeScript
25 lines
No EOL
693 B
TypeScript
|
|
import { ContainerProps } from "@mui/material";
|
|
import { createContext, Dispatch, SetStateAction, useState } from "react";
|
|
|
|
type DrawerOpenContextType = {
|
|
drawerOpen: boolean,
|
|
setDrawerOpen: Dispatch<SetStateAction<boolean>>
|
|
}
|
|
|
|
const DrawerOpenContext = createContext<DrawerOpenContextType>({
|
|
drawerOpen: false,
|
|
setDrawerOpen: () => {},
|
|
})
|
|
|
|
const DrawerOpenContextProvider = (props: ContainerProps) => {
|
|
const [drawerOpen, setDrawerOpen] = useState(false)
|
|
|
|
return (
|
|
<DrawerOpenContext.Provider value={{drawerOpen, setDrawerOpen}}>
|
|
{props.children}
|
|
</DrawerOpenContext.Provider>
|
|
)
|
|
}
|
|
|
|
export {DrawerOpenContext, DrawerOpenContextProvider} |