From fcfdf8ac679226d71ef8d28ce22080a8d21800ec Mon Sep 17 00:00:00 2001 From: Dahyeon Park Date: Fri, 7 Nov 2025 15:56:24 +0900 Subject: [PATCH] Adds responsive sidebar and header Implements a responsive design for the left sidebar, making it collapsible on smaller screens. Adds a hamburger menu icon in the header to toggle the sidebar's visibility on mobile devices, improving the user experience on smaller screens. The right sidebar is now hidden on smaller screens and only visible on extra large screens. --- src/shared/Layout.tsx | 37 ++++++++++++++++++++++++++++------ src/shared/LeftSidebar.tsx | 40 ++++++++++++++++++++++++++++++++++--- src/shared/RightSidebar.tsx | 4 ++-- 3 files changed, 70 insertions(+), 11 deletions(-) diff --git a/src/shared/Layout.tsx b/src/shared/Layout.tsx index 2746334..2551485 100644 --- a/src/shared/Layout.tsx +++ b/src/shared/Layout.tsx @@ -1,5 +1,7 @@ import type { ReactNode } from 'react'; +import { useState } from 'react'; import { Link } from 'react-router-dom'; +import { HamburgerMenuIcon, Cross1Icon } from '@radix-ui/react-icons'; import { LeftSidebar } from './LeftSidebar'; interface LayoutProps { @@ -9,19 +11,42 @@ interface LayoutProps { } export function Layout({ children, showSidebar = true, rightSidebar }: LayoutProps) { + const [isMobileSidebarOpen, setIsMobileSidebarOpen] = useState(false); + return (
{/* Left Sidebar - fixed positioning */} - {showSidebar && } + {showSidebar && ( + setIsMobileSidebarOpen(false)} + /> + )} {/* Main Content */} -
+
{/* Top Header */}
- - Gem Wiki (잼위키) - +
+ {/* Hamburger Menu Button - only visible on mobile/tablet */} + {showSidebar && ( + + )} + + Gem Wiki (잼위키) + +
+ ); } diff --git a/src/shared/RightSidebar.tsx b/src/shared/RightSidebar.tsx index 297ce53..32c26fb 100644 --- a/src/shared/RightSidebar.tsx +++ b/src/shared/RightSidebar.tsx @@ -16,7 +16,7 @@ export function RightSidebar() { if (headings.length === 0) { return ( -