Merge branch 'main' into feature/0612_sentry_fr_merge
# Conflicts: # apps/cs/src/pages/module/ui/module-page.tsx
This commit is contained in:
@@ -11,7 +11,14 @@ import {
|
||||
} from "@radix-ui/react-icons";
|
||||
import { cn } from "../../lib";
|
||||
import { Button } from "../button";
|
||||
import { Table, TableCell, TableHead, TableHeader, TableRow } from "../table";
|
||||
import {
|
||||
Table,
|
||||
TableCaption,
|
||||
TableCell,
|
||||
TableHead,
|
||||
TableHeader,
|
||||
TableRow,
|
||||
} from "../table";
|
||||
import type { HTMLAttributes } from "react";
|
||||
declare module "@tanstack/react-table" {
|
||||
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
||||
@@ -28,6 +35,7 @@ type DataTableProps<T> = {
|
||||
className?: HTMLAttributes<HTMLTableElement>["className"];
|
||||
viewPagination?: boolean;
|
||||
onRowClick?: (row: T) => void;
|
||||
caption?: string;
|
||||
};
|
||||
|
||||
function DataTable<T>({
|
||||
@@ -36,10 +44,12 @@ function DataTable<T>({
|
||||
className,
|
||||
viewPagination,
|
||||
onRowClick,
|
||||
caption,
|
||||
}: DataTableProps<T>) {
|
||||
return (
|
||||
<>
|
||||
<Table className={cn("w-full", className)} variant={variant}>
|
||||
{caption && <TableCaption className="sr-only">{caption}</TableCaption>}
|
||||
<THead table={table} />
|
||||
<tbody>
|
||||
{table.getRowModel().rows.map((row) => {
|
||||
@@ -48,8 +58,16 @@ function DataTable<T>({
|
||||
<TableRow
|
||||
key={row.id}
|
||||
onClick={() => onRowClick?.(row.original)}
|
||||
onKeyDown={(event) => {
|
||||
if (event.target !== event.currentTarget) return;
|
||||
if (event.key !== "Enter" && event.key !== " ") return;
|
||||
event.preventDefault();
|
||||
onRowClick?.(row.original);
|
||||
}}
|
||||
tabIndex={onRowClick ? 0 : undefined}
|
||||
className={cn(
|
||||
onRowClick && "cursor-pointer hover:bg-accent",
|
||||
onRowClick &&
|
||||
"cursor-pointer hover:bg-accent focus-visible:outline focus-visible:outline-2 focus-visible:outline-primary",
|
||||
isSelectedRow && "!bg-primary-transparent",
|
||||
)}
|
||||
>
|
||||
|
||||
@@ -2,6 +2,7 @@ import "./header.css";
|
||||
|
||||
import { useEffect, useCallback, useState, useRef } from "react";
|
||||
import { useQuery } from "@tanstack/react-query";
|
||||
import { Minus, Plus } from "lucide-react";
|
||||
import { images } from "@common/assets";
|
||||
import type { AuthService, TokenManager } from "@common/auth";
|
||||
import { getRemainingMs } from "@common/auth";
|
||||
@@ -281,7 +282,11 @@ export function Header({
|
||||
}, []);
|
||||
|
||||
return (
|
||||
<header className="sticky top-0 z-30 box-border flex h-[6rem] w-full flex-col items-center justify-between border-b border-solid border-border bg-background sm:flex-row">
|
||||
<header
|
||||
id="gnb"
|
||||
tabIndex={-1}
|
||||
className="sticky top-0 z-30 box-border flex h-[6rem] w-full flex-col items-center justify-between border-b border-solid border-border bg-background sm:flex-row"
|
||||
>
|
||||
<div className="flex w-full items-center justify-between px-2 sm:w-auto sm:justify-start sm:px-4 md:px-6">
|
||||
<div className="flex items-center gap-2 sm:gap-4">
|
||||
<SidebarTrigger className="size-12 !bg-transparent p-2 hover:!bg-accent [&>svg]:!size-full [&>svg]:text-foreground" />
|
||||
@@ -358,9 +363,9 @@ export function Header({
|
||||
{userSiteList.content.map((site) => (
|
||||
<a
|
||||
key={site.siteId}
|
||||
href={site.dmnAddr}
|
||||
href={siteId === site.siteId ? "#" : site.dmnAddr}
|
||||
className="w-full py-2 text-center text-xl font-medium text-foreground transition-colors hover:text-primary"
|
||||
target="_blank"
|
||||
target={siteId === site.siteId ? "_self" : "_blank"}
|
||||
rel="noopener noreferrer"
|
||||
onClick={() => setIsMobileMenuOpen(false)}
|
||||
>
|
||||
@@ -380,9 +385,9 @@ export function Header({
|
||||
{userSiteList.content.map((site) => (
|
||||
<a
|
||||
key={site.siteId}
|
||||
href={site.dmnAddr}
|
||||
href={siteId === site.siteId ? "#" : site.dmnAddr}
|
||||
className="header-nav-link whitespace-nowrap text-sm font-medium text-foreground transition-colors hover:text-primary md:text-lg lg:text-2xl"
|
||||
target="_blank"
|
||||
target={siteId === site.siteId ? "_self" : "_blank"}
|
||||
rel="noopener noreferrer"
|
||||
>
|
||||
{site.siteNm}
|
||||
@@ -395,6 +400,7 @@ export function Header({
|
||||
{/* 데스크톱에서 오른쪽 요소들 */}
|
||||
<div className="hidden items-center gap-2 px-2 sm:flex md:px-4">
|
||||
<SearchForm />
|
||||
<ScreenZoomControls />
|
||||
{mounted ? (
|
||||
isLoggedIn && (
|
||||
<Popover>
|
||||
@@ -423,6 +429,48 @@ export function Header({
|
||||
);
|
||||
}
|
||||
|
||||
function ScreenZoomControls() {
|
||||
const [scale, setScale] = useState(1);
|
||||
|
||||
const updateScale = (nextScale: number) => {
|
||||
const boundedScale = Math.min(2, Math.max(0.5, nextScale));
|
||||
document.body.style.zoom = String(boundedScale);
|
||||
setScale(boundedScale);
|
||||
};
|
||||
|
||||
return (
|
||||
<div className="flex items-center gap-1" aria-label="화면 크기 조절">
|
||||
<Button
|
||||
type="button"
|
||||
variant="ghost"
|
||||
size="icon"
|
||||
className="size-[2.8rem] !bg-background p-2 text-foreground hover:!bg-accent"
|
||||
aria-label="화면 축소"
|
||||
title="화면 축소"
|
||||
disabled={scale <= 0.5}
|
||||
onClick={() => updateScale(Number((scale - 0.1).toFixed(1)))}
|
||||
>
|
||||
<Minus />
|
||||
</Button>
|
||||
<span className="min-w-12 text-center text-sm" aria-live="polite">
|
||||
{Math.round(scale * 100)}%
|
||||
</span>
|
||||
<Button
|
||||
type="button"
|
||||
variant="ghost"
|
||||
size="icon"
|
||||
className="size-[2.8rem] !bg-background p-2 text-foreground hover:!bg-accent"
|
||||
aria-label="화면 확대"
|
||||
title="화면 확대"
|
||||
disabled={scale >= 2}
|
||||
onClick={() => updateScale(Number((scale + 0.1).toFixed(1)))}
|
||||
>
|
||||
<Plus />
|
||||
</Button>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
function UserMenuContent({
|
||||
remainingMs,
|
||||
onLogout,
|
||||
|
||||
@@ -107,7 +107,7 @@ export function NoticePopover() {
|
||||
전체 선택
|
||||
</Label>
|
||||
</div>
|
||||
<ul>
|
||||
<ul className="max-h-[48rem] overflow-y-auto">
|
||||
{noticeUserList?.map((item) => (
|
||||
<li
|
||||
key={item.notiId}
|
||||
|
||||
@@ -7,6 +7,7 @@ import { SidebarProvider } from "../sidebar";
|
||||
import { LNB } from "../lnb";
|
||||
import { Header } from "../header";
|
||||
import { Footer } from "../footer";
|
||||
import { SkipNavigation } from "./skip-navigation";
|
||||
import "./common.css";
|
||||
|
||||
export function BaseLayout({
|
||||
@@ -30,6 +31,7 @@ export function BaseLayout({
|
||||
<PopupProvider>
|
||||
<SidebarProvider>
|
||||
<div className="flex-1">
|
||||
<SkipNavigation />
|
||||
<Header
|
||||
authService={authService}
|
||||
tokenManager={authService ? undefined : tokenManager}
|
||||
@@ -40,7 +42,9 @@ export function BaseLayout({
|
||||
handleMenuClick={handleMenuClick}
|
||||
/>
|
||||
<div className="flex min-h-[calc(100vh-50px)] flex-1 flex-col">
|
||||
<div className="flex-1">{children}</div>
|
||||
<main id="main-content" tabIndex={-1} className="flex-1">
|
||||
{children}
|
||||
</main>
|
||||
<Footer />
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -5,6 +5,7 @@ import type { MenuItem } from "../../api";
|
||||
import { SidebarProvider } from "../sidebar";
|
||||
import { LNB } from "../lnb";
|
||||
import { Header } from "../header";
|
||||
import { SkipNavigation } from "./skip-navigation";
|
||||
import "./common.css";
|
||||
import type { AuthService } from "@common/auth";
|
||||
|
||||
@@ -26,6 +27,7 @@ export function NoFooterLayout({
|
||||
<PopupProvider>
|
||||
<SidebarProvider>
|
||||
<div className="flex-1">
|
||||
<SkipNavigation />
|
||||
<Header authService={authService} />
|
||||
<div className="flex">
|
||||
<LNB
|
||||
@@ -33,7 +35,9 @@ export function NoFooterLayout({
|
||||
handleMenuClick={handleMenuClick}
|
||||
/>
|
||||
<div className="flex min-h-[calc(100vh-50px)] flex-1 flex-col overflow-auto">
|
||||
<div className="flex-1">{children}</div>
|
||||
<main id="main-content" tabIndex={-1} className="flex-1">
|
||||
{children}
|
||||
</main>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -6,6 +6,7 @@ import type { MenuItem } from "../../api";
|
||||
import { SidebarProvider } from "../sidebar";
|
||||
import { Header } from "../header";
|
||||
import { Footer } from "../footer";
|
||||
import { SkipNavigation } from "./skip-navigation";
|
||||
import "./common.css";
|
||||
|
||||
export function NoLNBLayout({
|
||||
@@ -24,10 +25,13 @@ export function NoLNBLayout({
|
||||
<PopupProvider>
|
||||
<SidebarProvider>
|
||||
<div className="flex-1">
|
||||
<SkipNavigation includeLnb={false} />
|
||||
<Header authService={authService} />
|
||||
<div className="flex">
|
||||
<div className="flex min-h-[calc(100vh-50px)] flex-1 flex-col overflow-auto">
|
||||
<div className="flex-1">{children}</div>
|
||||
<main id="main-content" tabIndex={-1} className="flex-1">
|
||||
{children}
|
||||
</main>
|
||||
<Footer />
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -0,0 +1,59 @@
|
||||
"use client";
|
||||
|
||||
import { useEffect, useRef } from "react";
|
||||
import { useSidebar } from "../sidebar";
|
||||
|
||||
type SkipNavigationProps = {
|
||||
includeLnb?: boolean;
|
||||
};
|
||||
|
||||
const linkClassName =
|
||||
"sr-only focus:not-sr-only focus:fixed focus:left-4 focus:top-4 focus:z-[100] focus:rounded-sm focus:bg-background focus:px-4 focus:py-3 focus:text-foreground focus:shadow-lg focus:outline focus:outline-2 focus:outline-primary";
|
||||
|
||||
export function SkipNavigation({
|
||||
includeLnb = true,
|
||||
}: SkipNavigationProps) {
|
||||
const { isMobile, open, openMobile, setOpen, setOpenMobile } = useSidebar();
|
||||
const shouldFocusLnb = useRef(false);
|
||||
|
||||
useEffect(() => {
|
||||
const isLnbOpen = isMobile ? openMobile : open;
|
||||
if (!shouldFocusLnb.current || !isLnbOpen) return;
|
||||
|
||||
document.getElementById("lnb")?.focus();
|
||||
shouldFocusLnb.current = false;
|
||||
}, [isMobile, open, openMobile]);
|
||||
|
||||
const handleLnbClick = (event: React.MouseEvent<HTMLAnchorElement>) => {
|
||||
event.preventDefault();
|
||||
const isLnbOpen = isMobile ? openMobile : open;
|
||||
|
||||
if (isLnbOpen) {
|
||||
document.getElementById("lnb")?.focus();
|
||||
return;
|
||||
}
|
||||
|
||||
shouldFocusLnb.current = true;
|
||||
if (isMobile) {
|
||||
setOpenMobile(true);
|
||||
} else {
|
||||
setOpen(true);
|
||||
}
|
||||
};
|
||||
|
||||
return (
|
||||
<nav aria-label="건너뛰기">
|
||||
<a className={linkClassName} href="#main-content">
|
||||
본문 바로가기
|
||||
</a>
|
||||
<a className={linkClassName} href="#gnb">
|
||||
주메뉴 바로가기
|
||||
</a>
|
||||
{includeLnb && (
|
||||
<a className={linkClassName} href="#lnb" onClick={handleLnbClick}>
|
||||
부메뉴 바로가기
|
||||
</a>
|
||||
)}
|
||||
</nav>
|
||||
);
|
||||
}
|
||||
@@ -3,6 +3,7 @@ import { SidebarProvider } from "../sidebar";
|
||||
import { LNB } from "../lnb";
|
||||
import { Header } from "../header";
|
||||
import { Footer } from "../footer";
|
||||
import { SkipNavigation } from "./skip-navigation";
|
||||
|
||||
import "./common.css";
|
||||
import type { QueryClient } from "@tanstack/react-query";
|
||||
@@ -18,13 +19,18 @@ export function VBaseLayout({
|
||||
<QueryProvider queryClient={queryClient}>
|
||||
<SidebarProvider>
|
||||
<div className="flex-1">
|
||||
<SkipNavigation />
|
||||
<Header viewOnly />
|
||||
<div className="flex h-[calc(100vh-50px)]">
|
||||
<LNB viewOnly />
|
||||
<div className="flex flex-1 flex-col">
|
||||
<div className="max-h-[calc(100%-50px)] flex-1 overflow-auto">
|
||||
<main
|
||||
id="main-content"
|
||||
tabIndex={-1}
|
||||
className="max-h-[calc(100%-50px)] flex-1 overflow-auto"
|
||||
>
|
||||
{children}
|
||||
</div>
|
||||
</main>
|
||||
<Footer />
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -57,6 +57,7 @@ export function LNB({
|
||||
const [currentMenuCode, setCurrentMenuCode] = useState<number | null>(null);
|
||||
const prevPathRef = useRef(currentPath);
|
||||
const { browser } = useDetectDevice();
|
||||
const { isMobile, setOpenMobile } = useSidebar();
|
||||
|
||||
const appSiteId = getCookie("site-id-key") ?? "";
|
||||
const siteId = propSiteId ?? appSiteId;
|
||||
@@ -90,6 +91,38 @@ export function LNB({
|
||||
return currentPath?.startsWith(path);
|
||||
}
|
||||
|
||||
function handleSidebarKeyDown(event: React.KeyboardEvent<HTMLDivElement>) {
|
||||
if (event.key !== "Tab") return;
|
||||
|
||||
const menuControls = Array.from(
|
||||
event.currentTarget.querySelectorAll<HTMLElement>(
|
||||
'[data-sidebar="menu-button"], [data-sidebar="menu-sub-button"]',
|
||||
),
|
||||
).filter(
|
||||
(control) =>
|
||||
control.tabIndex >= 0 &&
|
||||
!control.hasAttribute("disabled") &&
|
||||
control.getAttribute("aria-disabled") !== "true" &&
|
||||
!control.closest('[hidden], [aria-hidden="true"]'),
|
||||
);
|
||||
const currentIndex = menuControls.findIndex(
|
||||
(control) =>
|
||||
control === event.target ||
|
||||
control.contains(event.target as Node),
|
||||
);
|
||||
|
||||
if (currentIndex < 0) return;
|
||||
|
||||
const nextIndex = currentIndex + (event.shiftKey ? -1 : 1);
|
||||
const nextControl = menuControls[nextIndex];
|
||||
|
||||
if (nextControl) {
|
||||
event.preventDefault();
|
||||
nextControl.focus();
|
||||
nextControl.scrollIntoView({ block: "nearest" });
|
||||
}
|
||||
}
|
||||
|
||||
useEffect(() => {
|
||||
if (!menuList || !currentPath) return;
|
||||
|
||||
@@ -127,6 +160,7 @@ export function LNB({
|
||||
if (prevPathRef.current !== currentPath) {
|
||||
setDefaultOpenMenuIds(matchedMenuIds);
|
||||
prevPathRef.current = currentPath;
|
||||
if (isMobile) setOpenMobile(false);
|
||||
}
|
||||
|
||||
if (matchedMenuCode) {
|
||||
@@ -142,7 +176,7 @@ export function LNB({
|
||||
siteId,
|
||||
urlPath: currentPath,
|
||||
});
|
||||
}, [menuList, currentPath]);
|
||||
}, [menuList, currentPath, isMobile, setOpenMobile]);
|
||||
|
||||
function MenuItem({
|
||||
item,
|
||||
@@ -151,65 +185,103 @@ export function LNB({
|
||||
item: MenuItem;
|
||||
isSubMenu?: boolean;
|
||||
}) {
|
||||
const { open: isSidebarOpen, setOpen } = useSidebar();
|
||||
const {
|
||||
open: isSidebarOpen,
|
||||
isMobile: isMobileView,
|
||||
setOpenMobile: closeMobileSidebar,
|
||||
} = useSidebar();
|
||||
const isMatched =
|
||||
isPathMatched(item.urlPath) && currentMenuCode === item.menuCd;
|
||||
const hideLabel = !isSidebarOpen && !isMobileView;
|
||||
|
||||
const handleClick = () => {
|
||||
if (!isSidebarOpen) setOpen(true);
|
||||
const handleClick = (event: React.MouseEvent<HTMLAnchorElement>) => {
|
||||
setCookie("menu-code-key", item.menuCd.toString());
|
||||
|
||||
// newWndwYn이 Y인 경우 새창으로 열기
|
||||
if (item.newWndwYn === "Y") {
|
||||
window.open(item.urlPath, "_blank");
|
||||
if (item.newWndwYn !== "Y" && handleMenuClick) {
|
||||
event.preventDefault();
|
||||
handleMenuClick(item);
|
||||
if (isMobileView && currentPath === item.urlPath) {
|
||||
closeMobileSidebar(false);
|
||||
}
|
||||
} else if (isMobileView) {
|
||||
closeMobileSidebar(false);
|
||||
}
|
||||
|
||||
handleMenuClick?.(item);
|
||||
};
|
||||
|
||||
if (item.children) {
|
||||
if (item.children?.length) {
|
||||
return <MenuGroup item={item} />;
|
||||
}
|
||||
|
||||
const MenuItem = isSubMenu ? SidebarMenuSubItem : SidebarMenuItem;
|
||||
const MenuButton = isSubMenu ? SidebarMenuSubButton : SidebarMenuButton;
|
||||
const menuContent = (
|
||||
<>
|
||||
<i
|
||||
className={cn(
|
||||
"diveicon",
|
||||
`di-${item.iconNm}`,
|
||||
!hideLabel && "ml-2",
|
||||
)}
|
||||
/>
|
||||
<span className={cn("whitespace-nowrap", hideLabel && "hidden")}>
|
||||
{item.menuKornNm}
|
||||
</span>
|
||||
</>
|
||||
);
|
||||
const linkProps = {
|
||||
href: item.urlPath,
|
||||
target: item.newWndwYn === "Y" ? "_blank" : undefined,
|
||||
rel: item.newWndwYn === "Y" ? "noopener noreferrer" : undefined,
|
||||
"aria-current": isMatched ? ("page" as const) : undefined,
|
||||
onClick: handleClick,
|
||||
};
|
||||
const menuClassName = cn(
|
||||
"h-auto cursor-pointer py-4 text-[1.4rem] text-label transition-colors hover:bg-accent",
|
||||
isMatched && "bg-accent !text-primary",
|
||||
!isSidebarOpen && "justify-center",
|
||||
);
|
||||
|
||||
if (isSubMenu) {
|
||||
return (
|
||||
<SidebarMenuSubItem>
|
||||
<SidebarMenuSubButton
|
||||
{...linkProps}
|
||||
className={menuClassName}
|
||||
data-matched={isMatched}
|
||||
isActive={isMatched}
|
||||
>
|
||||
{menuContent}
|
||||
</SidebarMenuSubButton>
|
||||
</SidebarMenuSubItem>
|
||||
);
|
||||
}
|
||||
|
||||
return (
|
||||
<MenuItem>
|
||||
<MenuButton
|
||||
className={cn(
|
||||
"h-auto cursor-pointer py-4 text-[1.4rem] text-label transition-colors hover:bg-accent",
|
||||
isMatched && "bg-accent !text-primary",
|
||||
!isSidebarOpen && "justify-center",
|
||||
)}
|
||||
<SidebarMenuItem>
|
||||
<SidebarMenuButton
|
||||
asChild
|
||||
className={menuClassName}
|
||||
data-matched={isMatched}
|
||||
onClick={handleClick}
|
||||
tooltip={item.menuKornNm}
|
||||
>
|
||||
<i
|
||||
className={cn(
|
||||
"diveicon",
|
||||
`di-${item.iconNm}`,
|
||||
isSidebarOpen && "ml-2",
|
||||
)}
|
||||
/>
|
||||
<span className={cn("whitespace-nowrap", !isSidebarOpen && "hidden")}>
|
||||
{item.menuKornNm}
|
||||
</span>
|
||||
</MenuButton>
|
||||
</MenuItem>
|
||||
<a {...linkProps}>{menuContent}</a>
|
||||
</SidebarMenuButton>
|
||||
</SidebarMenuItem>
|
||||
);
|
||||
}
|
||||
|
||||
function MenuGroup({ item }: { item: MenuItem }) {
|
||||
const { open: isSidebarOpen, setOpen: setSidebarOpen } = useSidebar();
|
||||
const {
|
||||
open: isSidebarOpen,
|
||||
setOpen: setSidebarOpen,
|
||||
isMobile,
|
||||
} = useSidebar();
|
||||
const hideLabel = !isSidebarOpen && !isMobile;
|
||||
const [isOpen, setIsOpen] = useState(
|
||||
defaultOpenMenuIds.includes(item.menuCd),
|
||||
);
|
||||
|
||||
const handleOpenChange = (open: boolean) => {
|
||||
setIsOpen(open);
|
||||
if (!isSidebarOpen) setSidebarOpen(true);
|
||||
if (!isMobile && !isSidebarOpen) setSidebarOpen(true);
|
||||
};
|
||||
|
||||
return (
|
||||
@@ -233,13 +305,13 @@ export function LNB({
|
||||
className={cn(
|
||||
"diveicon text-label",
|
||||
`di-${item.iconNm}`,
|
||||
isSidebarOpen && "ml-2",
|
||||
!hideLabel && "ml-2",
|
||||
)}
|
||||
/>
|
||||
<span
|
||||
className={cn(
|
||||
"whitespace-nowrap text-label group-hover/menu-button:text-foreground",
|
||||
!isSidebarOpen && "hidden",
|
||||
hideLabel && "hidden",
|
||||
)}
|
||||
>
|
||||
{item.menuKornNm}
|
||||
@@ -249,7 +321,7 @@ export function LNB({
|
||||
className={cn(
|
||||
"ml-auto !size-6 text-label transition-transform",
|
||||
isOpen && "rotate-90",
|
||||
!isSidebarOpen && "hidden",
|
||||
hideLabel && "hidden",
|
||||
)}
|
||||
/>
|
||||
</SidebarMenuButton>
|
||||
@@ -270,11 +342,18 @@ export function LNB({
|
||||
<Sidebar
|
||||
collapsible="icon"
|
||||
className={cn(
|
||||
"border-border bg-background px-4 pt-[6rem]",
|
||||
"border-border bg-background px-4 pt-14 md:pt-[6rem]",
|
||||
classNames?.wrapper,
|
||||
)}
|
||||
>
|
||||
<SidebarContent className="bg-background">
|
||||
<SidebarContent
|
||||
id="lnb"
|
||||
role="navigation"
|
||||
aria-label="부메뉴"
|
||||
tabIndex={-1}
|
||||
className="bg-background"
|
||||
onKeyDown={handleSidebarKeyDown}
|
||||
>
|
||||
<SidebarMenu className="gap-0">
|
||||
{menuList?.map((item) => (
|
||||
<MenuItem key={item.menuCd} item={item} />
|
||||
|
||||
@@ -67,7 +67,7 @@ const SheetContent = React.forwardRef<
|
||||
{children}
|
||||
<SheetPrimitive.Close className="absolute right-4 top-4 rounded-sm opacity-70 ring-offset-background transition-opacity hover:opacity-100 focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none data-[state=open]:bg-secondary">
|
||||
<X className="h-4 w-4" />
|
||||
<span className="sr-only">Close</span>
|
||||
<span className="sr-only">닫기</span>
|
||||
</SheetPrimitive.Close>
|
||||
</SheetPrimitive.Content>
|
||||
</SheetPortal>
|
||||
|
||||
@@ -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}
|
||||
|
||||
@@ -79,12 +79,31 @@ const TableRow = React.forwardRef<
|
||||
));
|
||||
TableRow.displayName = "TableRow";
|
||||
|
||||
const TableHead = React.forwardRef<
|
||||
HTMLTableCellElement,
|
||||
React.ThHTMLAttributes<HTMLTableCellElement>
|
||||
>(({ className, ...props }, ref) => (
|
||||
<th ref={ref} className={cn("align-middle", className)} {...props} />
|
||||
));
|
||||
type TableHeadProps = React.ThHTMLAttributes<HTMLTableCellElement> & {
|
||||
"data-required"?: boolean | string;
|
||||
};
|
||||
|
||||
const TableHead = React.forwardRef<HTMLTableCellElement, TableHeadProps>(
|
||||
({ children, className, ...props }, ref) => {
|
||||
const isRequired = props["data-required"] !== undefined;
|
||||
|
||||
return (
|
||||
<th
|
||||
ref={ref}
|
||||
scope="col"
|
||||
className={cn("align-middle", className)}
|
||||
{...props}
|
||||
>
|
||||
{children}
|
||||
{isRequired && (
|
||||
<span className="table-required-marker" title="필수 항목">
|
||||
(*)
|
||||
</span>
|
||||
)}
|
||||
</th>
|
||||
);
|
||||
},
|
||||
);
|
||||
TableHead.displayName = "TableHead";
|
||||
|
||||
const TableCell = React.forwardRef<
|
||||
|
||||
@@ -7,9 +7,8 @@
|
||||
.table-ui th {
|
||||
@apply px-4 py-[1.2rem] text-[1.3rem] font-medium leading-[1.2];
|
||||
}
|
||||
.table-ui th[data-required]::before {
|
||||
content: "*";
|
||||
color: red;
|
||||
.table-ui th[data-required] .table-required-marker {
|
||||
@apply ml-1 text-red-600;
|
||||
}
|
||||
.table-ui td {
|
||||
@apply px-2 py-[1.2rem] text-[1.3rem] font-normal leading-[1.2];
|
||||
|
||||
Reference in New Issue
Block a user