좌측메뉴 탭 이동 처리

This commit is contained in:
2026-10-02 11:39:49 +09:00
parent a323c42acf
commit 4bdf68c2b6
3 changed files with 138 additions and 45 deletions
@@ -211,7 +211,7 @@ const Sidebar = React.forwardRef<
<SheetContent
data-sidebar="sidebar"
data-mobile="true"
className="w-[--sidebar-width] bg-sidebar p-0 text-sidebar-foreground [&>button]:hidden"
className="h-[100dvh] max-h-[100dvh] w-[--sidebar-width] overflow-hidden bg-sidebar p-0 text-sidebar-foreground [&>button]:z-50 [&>button]:rounded-sm [&>button]:p-2 [&>button]:text-sidebar-foreground [&>button]:opacity-100 [&>button]:hover:bg-sidebar-accent"
style={
{
"--sidebar-width": SIDEBAR_WIDTH_MOBILE,
@@ -223,7 +223,14 @@ const Sidebar = React.forwardRef<
<SheetTitle>Sidebar</SheetTitle>
<SheetDescription>Displays the mobile sidebar.</SheetDescription>
</SheetHeader>
<div className="flex h-full w-full flex-col">{children}</div>
<div
className={cn(
"flex h-full min-h-0 w-full flex-col",
className,
)}
>
{children}
</div>
</SheetContent>
</Sheet>
);
@@ -281,12 +288,22 @@ const SidebarTrigger = React.forwardRef<
React.ElementRef<typeof Button>,
React.ComponentProps<typeof Button>
>(({ className, onClick, ...props }, ref) => {
const { toggleSidebar } = useSidebar();
const { toggleSidebar, isMobile, openMobile, state } = useSidebar();
return (
<Button
ref={ref}
data-sidebar="trigger"
aria-label={
isMobile
? openMobile
? "좌측 메뉴 닫기"
: "좌측 메뉴 열기"
: state === "expanded"
? "좌측 메뉴 접기"
: "좌측 메뉴 펼치기"
}
aria-expanded={isMobile ? openMobile : state === "expanded"}
variant="ghost"
size="icon"
className={cn("h-7 w-7", className)}
@@ -297,7 +314,7 @@ const SidebarTrigger = React.forwardRef<
{...props}
>
<PanelLeft />
<span className="sr-only">Toggle Sidebar</span>
<span className="sr-only">좌측 메뉴 열기/닫기</span>
</Button>
);
});
@@ -422,7 +439,7 @@ const SidebarContent = React.forwardRef<
ref={ref}
data-sidebar="content"
className={cn(
"flex min-h-0 flex-1 flex-col gap-2 overflow-auto group-data-[collapsible=icon]:overflow-hidden",
"flex min-h-0 flex-1 flex-col gap-2 overflow-x-hidden overflow-y-auto overscroll-y-contain touch-pan-y group-data-[collapsible=icon]:overflow-hidden",
className,
)}
{...props}