feat: 순서변경 ▲/▼ 버튼 추가 (터치 지원) + 단가표 테이블 스크롤 수정
- ReorderButtons 공통 컴포넌트 신규 생성 (molecules) - 패턴B(리스트): RankManagement, TitleManagement, CategoryManagement - 패턴A(테이블): ProcessDetail, ProcessForm, ChecklistDetail - 패턴C(컴포넌트): DraggableSection, DraggableField, HierarchyTab - 모바일: GripVertical 숨김, ▲/▼ 버튼만 표시 - 데스크톱: GripVertical + ▲/▼ 버튼 모두 표시 - 단가표 단가정보 테이블 overflow-hidden → overflow-x-auto + min-w 적용
This commit is contained in:
61
src/components/molecules/ReorderButtons.tsx
Normal file
61
src/components/molecules/ReorderButtons.tsx
Normal file
@@ -0,0 +1,61 @@
|
||||
import { ChevronUp, ChevronDown } from 'lucide-react';
|
||||
import { Button } from '@/components/ui/button';
|
||||
import { cn } from '@/lib/utils';
|
||||
|
||||
interface ReorderButtonsProps {
|
||||
onMoveUp: () => void;
|
||||
onMoveDown: () => void;
|
||||
isFirst: boolean;
|
||||
isLast: boolean;
|
||||
disabled?: boolean;
|
||||
size?: 'sm' | 'xs';
|
||||
className?: string;
|
||||
}
|
||||
|
||||
export function ReorderButtons({
|
||||
onMoveUp,
|
||||
onMoveDown,
|
||||
isFirst,
|
||||
isLast,
|
||||
disabled = false,
|
||||
size = 'sm',
|
||||
className,
|
||||
}: ReorderButtonsProps) {
|
||||
const iconSize = size === 'xs' ? 'h-3 w-3' : 'h-4 w-4';
|
||||
const btnSize = size === 'xs' ? 'h-5 w-5' : 'h-6 w-6';
|
||||
|
||||
return (
|
||||
<div className={cn('flex flex-col', className)}>
|
||||
<Button
|
||||
type="button"
|
||||
variant="ghost"
|
||||
size="icon"
|
||||
className={cn(btnSize, 'p-0')}
|
||||
disabled={disabled || isFirst}
|
||||
onClick={(e) => {
|
||||
e.stopPropagation();
|
||||
e.preventDefault();
|
||||
onMoveUp();
|
||||
}}
|
||||
>
|
||||
<ChevronUp className={iconSize} />
|
||||
<span className="sr-only">위로 이동</span>
|
||||
</Button>
|
||||
<Button
|
||||
type="button"
|
||||
variant="ghost"
|
||||
size="icon"
|
||||
className={cn(btnSize, 'p-0')}
|
||||
disabled={disabled || isLast}
|
||||
onClick={(e) => {
|
||||
e.stopPropagation();
|
||||
e.preventDefault();
|
||||
onMoveDown();
|
||||
}}
|
||||
>
|
||||
<ChevronDown className={iconSize} />
|
||||
<span className="sr-only">아래로 이동</span>
|
||||
</Button>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
@@ -13,4 +13,6 @@ export { YearQuarterFilter } from "./YearQuarterFilter";
|
||||
export type { Quarter } from "./YearQuarterFilter";
|
||||
|
||||
export { GenericCRUDDialog } from "./GenericCRUDDialog";
|
||||
export type { GenericCRUDDialogProps, CRUDFieldDefinition } from "./GenericCRUDDialog";
|
||||
export type { GenericCRUDDialogProps, CRUDFieldDefinition } from "./GenericCRUDDialog";
|
||||
|
||||
export { ReorderButtons } from "./ReorderButtons";
|
||||
Reference in New Issue
Block a user