el.xwx.moe/layouts/MainLayout.tsx

37 lines
859 B
TypeScript
Raw Normal View History

2023-02-08 17:58:55 -06:00
import Navbar from "@/components/Navbar";
import Sidebar from "@/components/Sidebar";
2023-07-16 10:51:24 -05:00
import { ReactNode, useEffect } from "react";
2023-06-12 23:46:32 -05:00
import ModalManagement from "@/components/ModalManagement";
2023-07-16 10:51:24 -05:00
import useModalStore from "@/store/modals";
2023-02-08 17:58:55 -06:00
interface Props {
2023-02-08 17:58:55 -06:00
children: ReactNode;
}
export default function MainLayout({ children }: Props) {
2023-07-16 10:51:24 -05:00
const { modal } = useModalStore();
useEffect(() => {
modal
? (document.body.style.overflow = "hidden")
: (document.body.style.overflow = "auto");
}, [modal]);
return (
<>
<ModalManagement />
2023-06-12 23:46:32 -05:00
<div className="flex">
<div className="hidden lg:block">
<Sidebar className="fixed top-0" />
</div>
2023-04-30 15:54:40 -05:00
<div className="w-full flex flex-col h-screen lg:ml-64 xl:ml-80">
<Navbar />
{children}
2023-02-08 17:58:55 -06:00
</div>
</div>
</>
);
2023-02-08 17:58:55 -06:00
}