그리드 정렬기능
This commit is contained in:
@@ -13,6 +13,7 @@ import {
|
||||
getStandardRowNumber,
|
||||
type ScrollMode,
|
||||
StandardDataTable,
|
||||
StandardTableSortHeader,
|
||||
type UiHeadProps,
|
||||
} from "@common/business_components";
|
||||
import type { UiTableSort } from "@common/business_components/ui/table";
|
||||
@@ -95,27 +96,13 @@ export default function MapPopupDataTable<T extends Record<string, unknown>>({
|
||||
const title = ROW_NUMBER_IDS.has(head.id) ? "순번" : head.title;
|
||||
if (!head.sortable || !onSortChange) return title;
|
||||
const key = head.sortKey ?? head.id;
|
||||
const direction = sort?.key === key ? sort.direction : undefined;
|
||||
return (
|
||||
<button
|
||||
type="button"
|
||||
className="inline-flex w-full items-center justify-center gap-1.5"
|
||||
aria-label={`${title} 정렬`}
|
||||
onClick={() => {
|
||||
if (direction === undefined) {
|
||||
onSortChange({ key, direction: "asc" });
|
||||
} else if (direction === "asc") {
|
||||
onSortChange({ key, direction: "desc" });
|
||||
} else {
|
||||
onSortChange(undefined);
|
||||
}
|
||||
}}
|
||||
>
|
||||
<span>{title}</span>
|
||||
<span className="text-[8px] leading-none" aria-hidden="true">
|
||||
{direction === "asc" ? "▲" : direction === "desc" ? "▼" : "↕"}
|
||||
</span>
|
||||
</button>
|
||||
<StandardTableSortHeader
|
||||
label={title}
|
||||
sortKey={key}
|
||||
sort={sort}
|
||||
onSortChange={onSortChange}
|
||||
/>
|
||||
);
|
||||
},
|
||||
cell: ({ row, getValue }) => {
|
||||
|
||||
Reference in New Issue
Block a user