2022-12-14 12:18:37 +00:00
|
|
|
import React, { useState } from "react";
|
2022-11-19 14:21:26 +00:00
|
|
|
// layouts
|
2022-12-16 16:20:09 +00:00
|
|
|
import Container from "layouts/container";
|
2022-12-16 20:05:19 +00:00
|
|
|
import Sidebar from "layouts/navbar/main-siderbar";
|
2022-12-16 19:48:26 +00:00
|
|
|
import Header from "layouts/navbar/header";
|
2022-11-24 13:48:18 +00:00
|
|
|
// components
|
2022-12-12 04:49:52 +00:00
|
|
|
import CreateProjectModal from "components/project/create-project-modal";
|
2022-11-19 14:21:26 +00:00
|
|
|
// types
|
|
|
|
import type { Props } from "./types";
|
|
|
|
|
2022-12-13 15:52:44 +00:00
|
|
|
const AppLayout: React.FC<Props> = ({
|
|
|
|
meta,
|
|
|
|
children,
|
|
|
|
noPadding = false,
|
|
|
|
bg = "primary",
|
2022-12-15 04:17:56 +00:00
|
|
|
noHeader = false,
|
2022-12-13 15:52:44 +00:00
|
|
|
breadcrumbs,
|
2022-12-15 04:17:56 +00:00
|
|
|
left,
|
2022-12-13 15:52:44 +00:00
|
|
|
right,
|
|
|
|
}) => {
|
2022-11-24 13:48:18 +00:00
|
|
|
const [isOpen, setIsOpen] = useState(false);
|
|
|
|
|
2022-11-19 14:21:26 +00:00
|
|
|
return (
|
|
|
|
<Container meta={meta}>
|
2022-11-24 13:48:18 +00:00
|
|
|
<CreateProjectModal isOpen={isOpen} setIsOpen={setIsOpen} />
|
|
|
|
<div className="h-screen w-full flex overflow-x-hidden">
|
|
|
|
<Sidebar />
|
2022-12-13 15:52:44 +00:00
|
|
|
<main className="h-screen w-full flex flex-col overflow-y-auto min-w-0">
|
2022-12-15 04:17:56 +00:00
|
|
|
{noHeader ? null : <Header breadcrumbs={breadcrumbs} left={left} right={right} />}
|
2022-12-13 15:52:44 +00:00
|
|
|
<div
|
|
|
|
className={`w-full flex-grow ${noPadding ? "" : "p-5"} ${
|
|
|
|
bg === "primary" ? "bg-primary" : bg === "secondary" ? "bg-secondary" : "bg-primary"
|
|
|
|
}`}
|
|
|
|
>
|
|
|
|
{children}
|
|
|
|
</div>
|
2022-12-07 23:27:10 +00:00
|
|
|
</main>
|
2022-11-19 14:21:26 +00:00
|
|
|
</div>
|
|
|
|
</Container>
|
|
|
|
);
|
|
|
|
};
|
|
|
|
|
2022-12-07 23:27:10 +00:00
|
|
|
export default AppLayout;
|