-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathBaseLayout.tsx
39 lines (34 loc) · 979 Bytes
/
BaseLayout.tsx
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
import { motion } from "framer-motion"
import { type FC } from "react"
import { useSidebarStore } from "../../state"
import AlertManager from "../Alerts/AlertManager"
import ModalManager from "../Modals/ModalManager"
import Sidebar from "../Navigation/Sidebar"
type Props = {
children: React.ReactNode
}
const BaseLayout:FC<Props> = ({children}:Props) => {
const { isSidebarOpen } = useSidebarStore()
const variants = {
open: { marginLeft: "16rem" },
closed: { marginLeft: "8rem" }
}
return (
<div className="flex w-screen h-screen relative bg-base-200">
<Sidebar />
<motion.section
animate={
isSidebarOpen ? "open" : "closed"
}
variants={variants}
initial={false}
className={"flex flex-grow bg-base-200 z-10 h-full p-4"}
>
{children}
</motion.section>
<AlertManager/>
<ModalManager/>
</div>
)
}
export default BaseLayout