forked from StellarSplit/StellarSplit
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathRootLayout.tsx
More file actions
37 lines (33 loc) · 1.05 KB
/
Copy pathRootLayout.tsx
File metadata and controls
37 lines (33 loc) · 1.05 KB
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
import { useState } from "react";
import { Outlet } from "react-router";
import Navbar from "../components/Navbar";
import Sidebar from "@components/SIdebar";
export default function RootLayout() {
const [sidebarOpen, setSidebarOpen] = useState<boolean>(false);
return (
<div style={{ minHeight: "100vh", backgroundColor: "var(--color-bg)" }}>
{/* Fixed sidebar */}
<Sidebar isOpen={sidebarOpen} onClose={() => setSidebarOpen(false)} />
{/*
Main area — offset by sidebar width (14rem = lg:ml-56) on large screens.
On mobile the sidebar overlays, so no offset needed.
*/}
<div
style={{ transition: "margin-left 0.3s cubic-bezier(0.4, 0, 0.2, 1)" }}
className="lg:ml-56"
>
{/* Sticky top navbar */}
<Navbar onMenuOpen={() => setSidebarOpen(true)} />
{/* Page content */}
<main
style={{
padding: "1.5rem",
minHeight: "calc(100vh - 3.5rem)",
}}
>
<Outlet />
</main>
</div>
</div>
);
}