[feat] negodata/front: 디자인 리뉴얼 1차 — 인디고 콘솔 토큰·⌘K 크롬·대시보드/로그인/알림함 개편, 툴바 통일, 시트 스크롤 수정

This commit is contained in:
minaChoi committed 2026-07-16 16:24:40 +09:00
1 parent 3d515055fb
commit 25e13d7b01
20 files changed
+805 -580

No files matched your search

+210 -53
View File
@@ -1,10 +1,11 @@
import { useState, type ReactNode, type ElementType } from 'react';
import { useEffect, useState, type ReactNode, type ElementType } from 'react';
import { PageType } from '@/types';
import { useAuth } from '@/features/auth/useAuth';
import { ProfileSheet } from '@/features/auth/components/ProfileSheet';
import { Button } from '@/components/ui/button';
import { Badge } from '@/components/ui/badge';
import { Typography } from '@/components/ui/typography';
import { Dialog, DialogContent, DialogTitle } from '@/components/ui/dialog';
import { cn } from '@/lib/utils';
import { NotificationBell } from './NotificationBell';
import {
@@ -17,6 +18,7 @@ import {
FileSpreadsheet,
Layers,
LogOut,
Search,
Sun,
Moon,
Building,
@@ -34,17 +36,34 @@ interface LayoutProps {
type SidebarUser = ReturnType<typeof useAuth>['user'];
type MenuItem = { type: PageType; label: string; icon: ElementType; id: string; ownerOnly?: boolean };
// ownerOnly 항목은 최고관리자에게만 노출된다(렌더 시 user.role 로 필터).
const menuItems: { type: PageType; label: string; icon: ElementType; id: string; ownerOnly?: boolean }[] = [
{ type: 'DASHBOARD', label: '대시보드', icon: LayoutDashboard, id: 'sidebar-dashboard' },
{ type: 'STATISTICS', label: '통계', icon: BarChart3, id: 'sidebar-statistics' },
{ type: 'PRODUCTS', label: '상품관리', icon: Briefcase, id: 'sidebar-products' },
{ type: 'PARTNERS', label: '협력사관리', icon: Users, id: 'sidebar-partners' },
{ type: 'QUOTATION', label: '견적관리', icon: FileSpreadsheet, id: 'sidebar-quotation' },
{ type: 'CARDS', label: '협상카드관리', icon: Layers, id: 'sidebar-cards' },
{ type: 'MEMBERS', label: '회원관리', icon: UserCog, id: 'sidebar-members', ownerOnly: true },
// 그룹 라벨은 사이드바 섹션 헤더로 노출(접힘 상태에선 숨김).
const menuGroups: { label?: string; items: MenuItem[] }[] = [
{
items: [
{ type: 'DASHBOARD', label: '대시보드', icon: LayoutDashboard, id: 'sidebar-dashboard' },
{ type: 'STATISTICS', label: '통계', icon: BarChart3, id: 'sidebar-statistics' },
],
},
{
label: '업무',
items: [
{ type: 'PRODUCTS', label: '상품관리', icon: Briefcase, id: 'sidebar-products' },
{ type: 'PARTNERS', label: '협력사관리', icon: Users, id: 'sidebar-partners' },
{ type: 'QUOTATION', label: '견적관리', icon: FileSpreadsheet, id: 'sidebar-quotation' },
{ type: 'CARDS', label: '협상카드관리', icon: Layers, id: 'sidebar-cards' },
],
},
{
label: '관리',
items: [{ type: 'MEMBERS', label: '회원관리', icon: UserCog, id: 'sidebar-members', ownerOnly: true }],
},
];
const menuItems: MenuItem[] = menuGroups.flatMap((g) => g.items);
const pageLabelMap: Record<PageType, string> = {
DASHBOARD: '대시보드',
STATISTICS: '통계',
@@ -65,10 +84,25 @@ export default function Layout({ children, currentPage, setPage, onLogout }: Lay
const [isSidebarOpen, setIsSidebarOpen] = useState(true); // 데스크톱 접기 토글
const [isMobileOpen, setIsMobileOpen] = useState(false); // 모바일 드로어 열림
const [isProfileOpen, setIsProfileOpen] = useState(false); // 내 정보 수정 시트
const [isCmdOpen, setIsCmdOpen] = useState(false); // ⌘K 빠른 이동
// 사이드바 펼침 여부(라벨/프로필 노출 기준). 모바일 드로어는 항상 펼친 상태로 본다.
const expanded = isMobileOpen || isSidebarOpen;
const visibleItems = menuItems.filter((item) => !item.ownerOnly || user?.role === '최고관리자');
// ⌘K / Ctrl+K 로 빠른 이동 열기
useEffect(() => {
const onKey = (e: KeyboardEvent) => {
if ((e.metaKey || e.ctrlKey) && e.key.toLowerCase() === 'k') {
e.preventDefault();
setIsCmdOpen((v) => !v);
}
};
window.addEventListener('keydown', onKey);
return () => window.removeEventListener('keydown', onKey);
}, []);
const toggleDarkMode = () => {
setIsDark(!isDark);
if (!isDark) {
@@ -94,7 +128,7 @@ export default function Layout({ children, currentPage, setPage, onLogout }: Lay
{/* Main Sidebar */}
<aside
className={cn(
'bg-card border-r border-border flex flex-col justify-between transition-all duration-300 z-40 fixed inset-y-0 left-0',
'bg-sidebar border-r border-sidebar-border flex flex-col justify-between transition-all duration-300 z-40 fixed inset-y-0 left-0',
// 폭: 모바일은 항상 펼친 드로어(w-60), 데스크톱만 접기 토글
'w-60',
isSidebarOpen ? 'md:w-60' : 'md:w-16',
@@ -103,11 +137,12 @@ export default function Layout({ children, currentPage, setPage, onLogout }: Lay
'md:translate-x-0'
)}
>
<div>
<div className="min-h-0 flex flex-col">
{/* Sidebar Brand Header */}
<div className="h-14 flex items-center justify-between px-4 border-b border-border">
<div className="h-14 shrink-0 flex items-center justify-between px-4 border-b border-sidebar-border">
{expanded && (
<Typography as="div" variant="body" className="text-primary font-extrabold tracking-tighter">
<Typography as="div" variant="body" className="flex items-center gap-2 font-extrabold tracking-tight text-foreground">
<span aria-hidden className="size-4 rounded-[5px] bg-primary" />
NegoData
</Typography>
)}
@@ -117,8 +152,8 @@ export default function Layout({ children, currentPage, setPage, onLogout }: Lay
variant="ghost"
onClick={() => setIsSidebarOpen((v) => !v)}
className={cn(
'hidden md:inline-flex p-1 h-auto rounded text-muted-foreground',
!isSidebarOpen && 'mx-auto bg-muted/65'
'hidden md:inline-flex p-1 h-auto rounded text-sidebar-foreground hover:bg-sidebar-accent hover:text-sidebar-accent-foreground dark:hover:bg-sidebar-accent',
!isSidebarOpen && 'mx-auto bg-sidebar-accent'
)}
title={isSidebarOpen ? '메뉴 접기' : '메뉴 열기'}
>
@@ -129,7 +164,7 @@ export default function Layout({ children, currentPage, setPage, onLogout }: Lay
<Button
variant="ghost"
onClick={() => setIsMobileOpen(false)}
className="md:hidden p-1 h-auto rounded text-muted-foreground"
className="md:hidden p-1 h-auto rounded text-sidebar-foreground hover:bg-sidebar-accent hover:text-sidebar-accent-foreground dark:hover:bg-sidebar-accent"
title="메뉴 닫기"
>
<X size={16} className="size-4" />
@@ -140,32 +175,48 @@ export default function Layout({ children, currentPage, setPage, onLogout }: Lay
{expanded && <SidebarProfileCard user={user} />}
{/* Nav Items */}
<nav className="mt-2 px-3 space-y-1">
{menuItems
.filter((item) => !item.ownerOnly || user?.role === '최고관리자')
.map((item) => (
<NavItem
key={item.type}
item={item}
isActive={currentPage === item.type}
isOpen={expanded}
onClick={() => {
setPage(item.type);
setIsMobileOpen(false);
}}
/>
))}
<nav className="mt-1 px-3 overflow-y-auto">
{menuGroups.map((group, gi) => {
const items = group.items.filter((item) => !item.ownerOnly || user?.role === '최고관리자');
if (items.length === 0) return null;
return (
<div key={group.label ?? gi} className="space-y-0.5">
{group.label && expanded && (
<Typography
variant="caption"
className="block px-3 pt-4 pb-1 text-[10px] font-bold uppercase tracking-wider text-sidebar-foreground/70"
>
{group.label}
</Typography>
)}
{/* 접힘 상태에선 라벨 대신 얇은 구분선으로 그룹 경계를 남긴다 */}
{group.label && !expanded && <div className="my-2 border-t border-sidebar-border" />}
{items.map((item) => (
<NavItem
key={item.type}
item={item}
isActive={currentPage === item.type}
isOpen={expanded}
onClick={() => {
setPage(item.type);
setIsMobileOpen(false);
}}
/>
))}
</div>
);
})}
</nav>
</div>
{/* Sidebar Footer Controls */}
<div className="p-2 border-t border-border space-y-1">
<div className="p-2 border-t border-sidebar-border space-y-1">
{/* 내 정보 수정 */}
<Button
id="sidebar-profile-edit"
variant="ghost"
onClick={() => setIsProfileOpen(true)}
className="w-full justify-start gap-3 py-1.5 px-3 h-auto rounded text-[11px] font-semibold text-muted-foreground"
className="w-full justify-start gap-3 py-1.5 px-3 h-auto rounded text-[11px] font-semibold text-sidebar-foreground hover:bg-sidebar-accent hover:text-sidebar-accent-foreground dark:hover:bg-sidebar-accent"
>
<UserPen size={14} className="size-3.5" />
{expanded && <span>내 정보 수정</span>}
@@ -175,7 +226,7 @@ export default function Layout({ children, currentPage, setPage, onLogout }: Lay
<Button
variant="ghost"
onClick={toggleDarkMode}
className="w-full justify-start gap-3 py-1.5 px-3 h-auto rounded text-[11px] font-semibold text-muted-foreground"
className="w-full justify-start gap-3 py-1.5 px-3 h-auto rounded text-[11px] font-semibold text-sidebar-foreground hover:bg-sidebar-accent hover:text-sidebar-accent-foreground dark:hover:bg-sidebar-accent"
>
{isDark ? <Sun size={14} className="text-warning size-3.5" /> : <Moon size={14} className="size-3.5" />}
{expanded && <span>{isDark ? '라이트 모드' : '다크 모드'}</span>}
@@ -186,7 +237,7 @@ export default function Layout({ children, currentPage, setPage, onLogout }: Lay
id="header-logout-button"
variant="ghost"
onClick={onLogout}
className="w-full justify-start gap-3 py-1.5 px-3 h-auto rounded text-[11px] font-semibold text-destructive hover:bg-destructive/10 hover:text-destructive"
className="w-full justify-start gap-3 py-1.5 px-3 h-auto rounded text-[11px] font-semibold text-destructive hover:bg-destructive/10 hover:text-destructive dark:hover:bg-destructive/10"
>
<LogOut size={14} className="size-3.5" />
{expanded && <span>시스템 로그아웃</span>}
@@ -202,9 +253,9 @@ export default function Layout({ children, currentPage, setPage, onLogout }: Lay
isSidebarOpen ? 'md:pl-60' : 'md:pl-16'
)}
>
{/* Global Header */}
<header className="h-14 bg-card border-b border-border flex items-center justify-between px-4 md:px-8 sticky top-0 z-20 shadow-xs backdrop-blur-md bg-opacity-95">
<div className="flex items-center gap-2 md:gap-4 min-w-0">
{/* Global Header — 좌: 페이지명 / 중: 빠른 이동(⌘K) / 우: 알림·계정 메타 */}
<header className="h-14 bg-card border-b border-border grid grid-cols-[1fr_auto] md:grid-cols-[1fr_auto_1fr] items-center gap-3 px-4 md:px-6 sticky top-0 z-20">
<div className="flex items-center gap-2 md:gap-3 min-w-0">
{/* 모바일 햄버거 */}
<Button
variant="ghost"
@@ -220,7 +271,24 @@ export default function Layout({ children, currentPage, setPage, onLogout }: Lay
</Typography>
</div>
<div className="flex items-center gap-3 md:gap-4">
{/* 빠른 이동 트리거 */}
<button
type="button"
onClick={() => setIsCmdOpen(true)}
className="hidden md:flex w-56 lg:w-72 items-center justify-between gap-3 rounded-lg border border-border bg-muted/40 px-3 py-1.5 text-muted-foreground transition-colors hover:bg-muted/70 cursor-pointer"
>
<span className="flex items-center gap-2 min-w-0">
<Search size={13} className="shrink-0" />
<Typography as="span" variant="caption" className="truncate">
메뉴 빠른 이동
</Typography>
</span>
<Typography as="kbd" variant="caption" className="rounded bg-muted px-1.5 py-0.5 font-mono text-[10px]">
⌘K
</Typography>
</button>
<div className="flex items-center gap-3 md:gap-4 justify-self-end">
<NotificationBell />
<HeaderMeta user={user} today={today} />
</div>
@@ -237,11 +305,100 @@ export default function Layout({ children, currentPage, setPage, onLogout }: Lay
</footer>
</div>
<CommandMenu
open={isCmdOpen}
onOpenChange={setIsCmdOpen}
items={visibleItems}
currentPage={currentPage}
onSelect={(type) => {
setPage(type);
setIsCmdOpen(false);
}}
/>
{isProfileOpen && <ProfileSheet open onClose={() => setIsProfileOpen(false)} />}
</div>
);
}
/** ⌘K 빠른 이동 — 메뉴 검색·이동. 검색 대상 확장(견적명 등)은 추후 단계 */
function CommandMenu({
open,
onOpenChange,
items,
currentPage,
onSelect,
}: {
open: boolean;
onOpenChange: (open: boolean) => void;
items: MenuItem[];
currentPage: PageType;
onSelect: (type: PageType) => void;
}) {
const [query, setQuery] = useState('');
useEffect(() => {
if (!open) setQuery('');
}, [open]);
const q = query.trim().toLowerCase();
const filtered = q ? items.filter((i) => i.label.toLowerCase().includes(q)) : items;
return (
<Dialog open={open} onOpenChange={onOpenChange}>
<DialogContent
showCloseButton={false}
className="top-[18%] translate-y-0 gap-0 overflow-hidden p-0 sm:max-w-md"
>
<DialogTitle className="sr-only">메뉴 빠른 이동</DialogTitle>
<div className="flex items-center gap-2.5 border-b border-border px-3.5">
<Search size={15} className="shrink-0 text-muted-foreground" />
<input
/* 커맨드 입력은 보더 없는 관례라 ui/Input 대신 소재 그대로 사용 */
autoFocus
value={query}
onChange={(e) => setQuery(e.target.value)}
onKeyDown={(e) => {
if (e.key === 'Enter' && filtered.length > 0) onSelect(filtered[0].type);
}}
placeholder="이동할 메뉴 검색…"
className="h-11 w-full bg-transparent text-sm outline-none placeholder:text-muted-foreground"
/>
</div>
<div className="max-h-72 overflow-y-auto p-1.5">
{filtered.length === 0 ? (
<Typography variant="muted" className="px-3 py-4 text-xs">
일치하는 메뉴가 없습니다
</Typography>
) : (
filtered.map((item) => {
const Icon = item.icon;
return (
<button
key={item.type}
type="button"
onClick={() => onSelect(item.type)}
className="flex w-full cursor-pointer items-center gap-2.5 rounded-md px-3 py-2 text-left transition-colors hover:bg-accent"
>
<Icon size={15} className="shrink-0 text-muted-foreground" />
<Typography as="span" variant="small" className="flex-1 truncate">
{item.label}
</Typography>
{item.type === currentPage && (
<Typography as="span" variant="caption">
현재 화면
</Typography>
)}
</button>
);
})
)}
</div>
</DialogContent>
</Dialog>
);
}
/** 라벨:값 한 줄 (사이드바 프로필 카드용) */
function InfoRow({
label,
@@ -256,8 +413,8 @@ function InfoRow({
}) {
return (
<div className="flex justify-between items-center">
<Typography variant="caption">{label}</Typography>
<Typography variant="caption" title={title} className={cn('font-bold text-foreground', valueClassName)}>
<Typography variant="caption" className="text-sidebar-foreground">{label}</Typography>
<Typography variant="caption" title={title} className={cn('font-bold text-foreground/90', valueClassName)}>
{value}
</Typography>
</div>
@@ -267,9 +424,9 @@ function InfoRow({
/** 사이드바 사용자 프로필 카드 */
function SidebarProfileCard({ user }: { user: SidebarUser }) {
return (
<div className="p-3.5 mx-4 my-4 rounded-lg bg-muted/80 border border-border flex flex-col gap-1.5 shadow-2xs">
<div className="flex items-center gap-2 pb-1.5 border-b border-border/50">
<Building size={13} className="text-primary" />
<div className="p-3.5 mx-3 my-3 rounded-lg bg-card border border-sidebar-border flex flex-col gap-1.5">
<div className="flex items-center gap-2 pb-1.5 border-b border-sidebar-border/60">
<Building size={13} className="text-sidebar-primary" />
<Typography variant="caption" className="font-bold text-foreground truncate max-w-[140px]" title="소속 고객사">
{user?.company}
</Typography>
@@ -281,11 +438,11 @@ function SidebarProfileCard({ user }: { user: SidebarUser }) {
label="이메일:"
value={user?.email}
title={user?.email}
valueClassName="font-mono text-foreground/90 truncate max-w-[80px]"
valueClassName="font-mono truncate max-w-[80px]"
/>
<InfoRow label="연락처:" value={user?.contact} valueClassName="font-mono" />
<div className="flex justify-between items-center pt-1 border-t border-border/20">
<Typography variant="caption">권한등급:</Typography>
<div className="flex justify-between items-center pt-1 border-t border-sidebar-border/60">
<Typography variant="caption" className="text-sidebar-foreground">권한등급:</Typography>
<Badge variant="secondary" className="text-[10px]">{user?.role}</Badge>
</div>
</div>
@@ -300,7 +457,7 @@ function NavItem({
isOpen,
onClick,
}: {
item: { type: PageType; label: string; icon: ElementType; id: string };
item: MenuItem;
isActive: boolean;
isOpen: boolean;
onClick: () => void;
@@ -312,13 +469,13 @@ function NavItem({
variant="ghost"
onClick={onClick}
className={cn(
'w-full justify-start gap-3 py-2 px-3 h-auto rounded text-xs font-semibold tracking-tight',
'w-full justify-start gap-3 py-2 px-3 h-auto rounded-md text-xs tracking-tight',
isActive
? 'bg-secondary text-foreground border-l-2 border-primary pl-2 hover:bg-secondary hover:text-foreground'
: 'text-muted-foreground hover:bg-muted/80'
? 'bg-sidebar-accent font-bold text-foreground hover:bg-sidebar-accent hover:text-foreground dark:hover:bg-sidebar-accent'
: 'font-semibold text-sidebar-foreground hover:bg-sidebar-accent/60 hover:text-sidebar-accent-foreground dark:hover:bg-sidebar-accent/60'
)}
>
<Icon size={16} className={cn('size-4', isActive ? 'text-foreground' : 'text-muted-foreground/85')} />
<Icon size={16} className={cn('size-4', isActive ? 'text-primary' : 'text-sidebar-foreground/85')} />
{isOpen && <span className="truncate">{item.label}</span>}
</Button>
);
@@ -340,7 +497,7 @@ function HeaderMeta({ user, today }: { user: SidebarUser; today: string }) {
as="span"
variant="caption"
id="header-company-name"
className="font-bold text-foreground underline decoration-1 truncate max-w-[140px] md:max-w-none"
className="font-bold text-foreground truncate max-w-[140px] md:max-w-none"
>
{user?.company}
</Typography>
@@ -2,8 +2,8 @@ import type { ComponentProps, ReactNode } from 'react';
import { Search, X } from 'lucide-react';
import { cn } from '@/lib/utils';
// 페이지 상단의 "검색/액션 바". card 외피 + 좌측(검색·필터) / 우측(액션 버튼) 레이아웃.
// products/partners/quotation에서 동일하게 반복되던 구조를 단일 출처로 통일.
// 페이지 상단의 "검색/액션 바" — 슬림 카드형(어드민 표준 문법). 좌측(검색·필터) / 우측(액션 버튼들).
// 카드 외피는 p-3 + 32px 컨트롤로 얇게 유지 — 페이지마다 높이가 달라지던 원인(두꺼운 패딩·줄바꿈)은 여기서 통제한다.
export function PageToolbar({
children,
actions,
@@ -16,27 +16,28 @@ export function PageToolbar({
return (
<div
className={cn(
'flex flex-col md:flex-row md:items-center justify-between gap-4 p-4 rounded-lg border border-border bg-card',
'flex flex-col gap-2 rounded-lg border border-border bg-card p-3 md:flex-row md:items-center md:justify-between',
className
)}
>
<div className="flex flex-1 flex-col sm:flex-row gap-3">{children}</div>
{actions && <div className="flex flex-wrap items-center gap-2">{actions}</div>}
<div className="flex flex-1 flex-col gap-2 sm:flex-row sm:items-center">{children}</div>
{actions && <div className="flex items-center gap-2">{actions}</div>}
</div>
);
}
// 돋보기 아이콘 + 검색 input. 매 페이지 복붙하던 동일 마크업을 컴포넌트화.
// 폭은 sm 이상에서 고정(w-72) — 툴바가 플랫이라 검색이 화면 전체로 늘어나면 허전해진다.
// onClear 가 주어지고 입력값이 있으면 우측에 X 버튼 노출 → 클릭 시 비우고 재검색.
export function SearchInput({ className, onClear, ...props }: ComponentProps<'input'> & { onClear?: () => void }) {
const hasValue = props.value != null && String(props.value).length > 0;
return (
<div className="relative flex-1">
<Search className="absolute left-3 top-2.5 h-4 w-4 text-muted-foreground" />
<div className="relative w-full shrink-0 sm:w-72">
<Search className="absolute left-2.5 top-2 h-4 w-4 text-muted-foreground" />
<input
type="text"
className={cn(
'w-full pl-9 pr-9 py-2 text-xs bg-background border border-border rounded focus:outline-none focus:border-foreground/40 text-foreground transition-colors font-mono',
'h-8 w-full rounded-lg border border-border bg-background pl-8 pr-8 text-xs text-foreground transition-colors focus:outline-none focus:border-ring/60',
className
)}
{...props}
@@ -46,7 +47,7 @@ export function SearchInput({ className, onClear, ...props }: ComponentProps<'in
type="button"
onClick={onClear}
aria-label="검색어 지우기"
className="absolute right-2.5 top-2.5 text-muted-foreground hover:text-foreground cursor-pointer transition-colors"
className="absolute right-2.5 top-2 text-muted-foreground hover:text-foreground cursor-pointer transition-colors"
>
<X className="h-4 w-4" />
</button>
+1 -1
View File
@@ -7,7 +7,7 @@ function Card({ className, ...props }: React.ComponentProps<"div">) {
<div
data-slot="card"
className={cn(
"flex flex-col gap-6 rounded-lg border border-border bg-card py-6 text-card-foreground shadow-sm",
"flex flex-col gap-6 rounded-lg border border-border bg-card py-6 text-card-foreground",
className
)}
{...props}
@@ -102,8 +102,9 @@ export function DataTable<T>({
<Table className="w-full text-xs">
<TableHeader>
<TableRow className="bg-muted/50 border-b border-border hover:bg-transparent">
{/* 체크박스 셀도 일반 헤더 셀과 같은 세로 패딩(py-2.5) — p-4 로 두면 체크박스 있는 표만 헤더가 높아진다 */}
{selection && (
<TableHead className="p-4 w-12 text-center">
<TableHead className="px-4 py-2.5 w-12 text-center">
<input
type="checkbox"
checked={isAllSelected}
@@ -144,7 +145,7 @@ export function DataTable<T>({
>
{selection && (
<TableCell
className="p-4 text-center w-12"
className="px-4 py-2 text-center w-12"
onClick={(e) => e.stopPropagation()}
>
<input
+9 -4
View File
@@ -1,4 +1,5 @@
import type { ReactNode } from 'react';
import { createPortal } from 'react-dom';
import { X } from 'lucide-react';
import { Typography } from '@/components/ui/typography';
@@ -12,16 +13,19 @@ type SheetProps = {
// 우측 슬라이드 드로어 껍데기. 백드롭 + 패널 + 헤더(액센트바·타이틀·닫기)만 담당하고
// 폼/내용은 children으로 받는다. ProductFormSheet·PartnerFormSheet 공통 셸.
// 백드롭 클릭 시 닫힘(기존 FormSheet 동작 유지).
// body 로 포털 — 페이지 스크롤 컨테이너(main) 안에 렌더되면 시트 스크롤이 끝에서
// 부모(main)로 체이닝돼 모바일에서 뒤 화면이 스크롤되므로, DOM 계보 자체를 분리한다.
export function Sheet({ open, title, onClose, children }: SheetProps) {
if (!open) return null;
return (
return createPortal(
<div className="fixed inset-0 z-50 flex justify-end bg-black/40 backdrop-blur-xs animate-fade-in">
{/* 백드롭 */}
<div className="flex-1 cursor-pointer" onClick={onClose} />
{/* 우측 드로어 패널 (패널 자체가 세로 스크롤 — justify-* 는 스크롤 시작점을 가려 안 씀) */}
<div className="w-full max-w-lg bg-card border-l border-border h-full shadow-2xl p-6 overflow-y-auto animate-slide-left">
{/* 우측 드로어 패널 (패널 자체가 세로 스크롤 — justify-* 는 스크롤 시작점을 가려 안 씀)
overscroll-contain: 스크롤 끝에서 배경으로 체이닝 차단 / pb 는 모바일 하단 바 safe-area 확보 */}
<div className="w-full max-w-lg bg-card border-l border-border h-full shadow-2xl p-6 pb-[calc(1.5rem+env(safe-area-inset-bottom))] overflow-y-auto overscroll-contain animate-slide-left">
<div>
{/* 헤더 */}
<div className="flex items-center justify-between pb-4 border-b border-border">
@@ -40,6 +44,7 @@ export function Sheet({ open, title, onClose, children }: SheetProps) {
{children}
</div>
</div>
</div>
</div>,
document.body,
);
}