Skip to content

Commit d96c3fe

Browse files
fix: make sidebar fixed to prevent re-rendering on content expansion
- Change sidebar from sticky to fixed positioning on desktop - Set sidebar width to w-80 (320px) - Add overflow-y-auto to sidebar for scrolling if needed - Add lg:ml-80 margin to main content to account for fixed sidebar - Sidebar now stays in place when content expands/collapses
1 parent c077ea3 commit d96c3fe

File tree

3 files changed

+3
-3
lines changed

3 files changed

+3
-3
lines changed

src/components/PageLayout.jsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ const PageLayout = ({ children }) => {
2323
{/* Page content */}
2424
<main
2525
id="main-content"
26-
className="flex-1 px-6 sm:px-10 flex flex-col gap-10 mt-16 sm:mt-24 min-h-screen"
26+
className="flex-1 px-6 sm:px-10 flex flex-col gap-10 mt-16 sm:mt-24 min-h-screen lg:ml-80"
2727
>
2828
<div className="flex-1">{children}</div>
2929
<Footer />

src/components/Sidebar.jsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ const Sidebar = ({ textColorClass, headingFontClass }) => {
2424
return (
2525
<aside
2626
className={`fantasy-page relative flex flex-col items-center gap-6 p-8
27-
lg:w-1/4 lg:sticky lg:top-0 lg:h-screen
27+
lg:fixed lg:left-0 lg:top-0 lg:h-screen lg:w-80 lg:overflow-y-auto
2828
`}
2929
>
3030
{/* Binding divider (book spine illusion) */}

src/pages/Home.jsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,7 @@ const Home = () => {
132132
{/* Main Content */}
133133
<main
134134
id="main-content"
135-
className={`fantasy-page flex flex-1 flex-col min-h-screen gap-10 p-10`}
135+
className={`fantasy-page flex flex-1 flex-col min-h-screen gap-10 p-10 lg:ml-80`}
136136
>
137137
<div className="flex-1 flex flex-col justify-center gap-10">
138138
<section className="rounded-3xl border border-transparent bg-transparent shadow-none">

0 commit comments

Comments
 (0)