- 일정 등록 및 조회 컴포넌트 설계 및 구현 중
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
import SideBar from "@/ui/component/SideBar";
|
||||
import { Outlet } from "react-router-dom";
|
||||
import { Outlet, useNavigate } from "react-router-dom";
|
||||
import { SidebarProvider } from "@/components/ui/sidebar";
|
||||
import Header from "@/ui/component/Header";
|
||||
import { useAuthStore } from '@/store/authStore';
|
||||
@@ -11,9 +11,22 @@ import {
|
||||
OctagonXIcon,
|
||||
TriangleAlertIcon,
|
||||
} from "lucide-react";
|
||||
import { useState } from "react";
|
||||
|
||||
export default function Layout() {
|
||||
const { authData } = useAuthStore();
|
||||
const [open, setOpen] = useState(false);
|
||||
const navigate = useNavigate();
|
||||
const pathname = location.pathname;
|
||||
|
||||
const goTo = (path: string) => {
|
||||
console.log(path);
|
||||
console.log(pathname);
|
||||
if (path === pathname) return;
|
||||
navigate(path);
|
||||
setOpen(false);
|
||||
}
|
||||
|
||||
return (
|
||||
<>
|
||||
<Toaster
|
||||
@@ -27,10 +40,11 @@ export default function Layout() {
|
||||
}}
|
||||
/>
|
||||
<SidebarProvider
|
||||
defaultOpen={false}
|
||||
open={open}
|
||||
onOpenChange={setOpen}
|
||||
id="root"
|
||||
>
|
||||
<SideBar />
|
||||
<SideBar goTo={goTo} />
|
||||
<div className="flex flex-col w-full h-full">
|
||||
{ authData ? <Header /> : null}
|
||||
<div className="w-full h-full p-2.5">
|
||||
|
||||
Reference in New Issue
Block a user