sort 관련 정리

This commit is contained in:
focp212@naver.com
2025-10-15 17:12:57 +09:00
parent 368b553bda
commit faccd7bd91
30 changed files with 439 additions and 258 deletions

View File

@@ -1,11 +1,10 @@
import { PATHS } from "@/shared/constants/paths";
import { SortTypeKeys } from "./types";
export const DEFAULT_PAGE_PARAM = {
cursor: 'string',
cursor: null,
size: 0,
sortBy: 'string',
sortOrder: 'ASC',
orderBy: 'string',
sortType: SortTypeKeys.LATEST,
limit: 0
};

View File

@@ -20,11 +20,9 @@ export enum CalendarType {
Single = 'Single'
};
export interface DefaultRequestPagination {
cursor: string;
cursor: string | null;
size: number;
sortBy: string;
sortOrder: string;
orderBy: string;
sortType: SortTypeKeys;
limit: number;
};
export interface DefaulResponsePagination {
@@ -84,13 +82,15 @@ export enum FooterItemActiveKey {
Settlement = 'Settlement',
Account = 'Account',
};
export enum SortByKeys {
New = 'New',
Amount = 'Amount',
export enum SortTypeKeys {
LATEST = 'LATEST',
OLDEST = 'OLDEST',
HIGH_AMOUNT = 'HIGH_AMOUNT',
LOW_AMOUNT = 'LOW_AMOUNT'
};
export interface SortOptionsBoxProps {
sortBy: SortByKeys;
onClickToSort: (sortBy: SortByKeys) => void;
export interface SortTypeBoxProps {
sortType: SortTypeKeys;
onClickToSort: (sortType: SortTypeKeys) => void;
};
export interface CodesSelectParams {

View File

@@ -1,22 +0,0 @@
import { SortByKeys, SortOptionsBoxProps } from '../model/types';
export const SortOptionsBox = ({
sortBy,
onClickToSort
}: SortOptionsBoxProps) => {
return (
<>
<div className="sort-options">
<button
className={ `sort-btn ${(sortBy === SortByKeys.New)? 'active': ''}` }
onClick={ () => onClickToSort(SortByKeys.New) }
></button>
<span className="sort-divider">|</span>
<button
className={ `sort-btn ${(sortBy === SortByKeys.Amount)? 'active': ''}` }
onClick={ () => onClickToSort(SortByKeys.Amount) }
></button>
</div>
</>
);
};

View File

@@ -0,0 +1,22 @@
import { SortTypeKeys, SortTypeBoxProps } from '../model/types';
export const SortTypeBox = ({
sortType,
onClickToSort
}: SortTypeBoxProps) => {
return (
<>
<div className="sort-options">
<button
className={ `sort-btn ${(sortType === SortTypeKeys.LATEST)? 'active': ''}` }
onClick={ () => onClickToSort(SortTypeKeys.LATEST) }
></button>
<span className="sort-divider">|</span>
<button
className={ `sort-btn ${(sortType === SortTypeKeys.HIGH_AMOUNT)? 'active': ''}` }
onClick={ () => onClickToSort(SortTypeKeys.HIGH_AMOUNT) }
></button>
</div>
</>
);
};