260617_01_ENH: 배정 테스트를 위해 개발 중도 커밋
This commit is contained in:
11
src/components/gwcf/EmptyRow.tsx
Normal file
11
src/components/gwcf/EmptyRow.tsx
Normal file
@@ -0,0 +1,11 @@
|
||||
"use client";
|
||||
|
||||
export function EmptyRow({colSpan}: {colSpan: number}) {
|
||||
return (
|
||||
<tr>
|
||||
<td colSpan={colSpan} className="h-28 border p-4 text-center text-sm text-muted-foreground">
|
||||
조회된 데이터가 없습니다.
|
||||
</td>
|
||||
</tr>
|
||||
);
|
||||
}
|
||||
25
src/components/gwcf/FilePendingButton.tsx
Normal file
25
src/components/gwcf/FilePendingButton.tsx
Normal file
@@ -0,0 +1,25 @@
|
||||
"use client";
|
||||
|
||||
import {ReactNode} from "react";
|
||||
import {Download, ImageIcon, Upload} from "lucide-react";
|
||||
import {Button} from "@/components/ui/button";
|
||||
|
||||
export function FilePendingButton({
|
||||
children,
|
||||
icon = "download",
|
||||
disabled = true,
|
||||
onClick,
|
||||
}: {
|
||||
children: ReactNode;
|
||||
icon?: "download" | "upload" | "image";
|
||||
disabled?: boolean;
|
||||
onClick?: () => void;
|
||||
}) {
|
||||
const Icon = icon === "upload" ? Upload : icon === "image" ? ImageIcon : Download;
|
||||
return (
|
||||
<Button type="button" size="xs" variant="outline" disabled={disabled} onClick={onClick}>
|
||||
<Icon className="h-3 w-3" />
|
||||
{children}
|
||||
</Button>
|
||||
);
|
||||
}
|
||||
37
src/components/gwcf/FilterSelect.tsx
Normal file
37
src/components/gwcf/FilterSelect.tsx
Normal file
@@ -0,0 +1,37 @@
|
||||
"use client";
|
||||
|
||||
import {KriSingleSelect} from "@/components/common/KriAutoComplete";
|
||||
import {Code} from "@/types/gwcf";
|
||||
|
||||
export function FilterSelect({
|
||||
value,
|
||||
onChange,
|
||||
options,
|
||||
placeholder,
|
||||
className,
|
||||
useClear = true,
|
||||
}: {
|
||||
value: string;
|
||||
onChange: (value: string) => void;
|
||||
options: Code[];
|
||||
placeholder: string;
|
||||
className?: string;
|
||||
useClear?: boolean;
|
||||
}) {
|
||||
return (
|
||||
<KriSingleSelect
|
||||
items={options}
|
||||
value={value}
|
||||
onChange={onChange}
|
||||
placeholder={placeholder}
|
||||
getValue={(item) => String(item.codeValue)}
|
||||
getLabel={(item) => item.codeLabel}
|
||||
useClear={useClear}
|
||||
clearLabel="전체"
|
||||
widthClassName={className}
|
||||
spanClassName="text-sm"
|
||||
badgeClassName="text-sm"
|
||||
className="h-9"
|
||||
/>
|
||||
);
|
||||
}
|
||||
34
src/components/gwcf/MultiFilterSelect.tsx
Normal file
34
src/components/gwcf/MultiFilterSelect.tsx
Normal file
@@ -0,0 +1,34 @@
|
||||
"use client";
|
||||
|
||||
import {KriMultiSelect} from "@/components/common/KriAutoComplete";
|
||||
import {Code} from "@/types/gwcf";
|
||||
|
||||
export function MultiFilterSelect({
|
||||
value,
|
||||
onChange,
|
||||
options,
|
||||
placeholder,
|
||||
className,
|
||||
}: {
|
||||
value: string[];
|
||||
onChange: (value: string[]) => void;
|
||||
options: Code[];
|
||||
placeholder: string;
|
||||
className?: string;
|
||||
}) {
|
||||
return (
|
||||
<KriMultiSelect
|
||||
items={options}
|
||||
value={value}
|
||||
onChange={onChange}
|
||||
placeholder={placeholder}
|
||||
getValue={(item) => String(item.codeValue)}
|
||||
getLabel={(item) => item.codeLabel}
|
||||
widthClassName={className}
|
||||
maxCount={1}
|
||||
spanClassName="text-sm"
|
||||
badgeClassName="text-sm"
|
||||
className="h-9"
|
||||
/>
|
||||
);
|
||||
}
|
||||
12
src/components/gwcf/PagePanel.tsx
Normal file
12
src/components/gwcf/PagePanel.tsx
Normal file
@@ -0,0 +1,12 @@
|
||||
"use client";
|
||||
|
||||
import {ReactNode} from "react";
|
||||
import {cn} from "@/lib/utils";
|
||||
|
||||
export function PagePanel({children, className}: {children: ReactNode; className?: string}) {
|
||||
return (
|
||||
<section className={cn("rounded-md border border-gray-300 bg-white p-4 shadow-sm", className)}>
|
||||
{children}
|
||||
</section>
|
||||
);
|
||||
}
|
||||
62
src/components/gwcf/StatusPill.tsx
Normal file
62
src/components/gwcf/StatusPill.tsx
Normal file
@@ -0,0 +1,62 @@
|
||||
"use client";
|
||||
|
||||
import {MouseEvent, ReactNode} from "react";
|
||||
import {Tooltip, TooltipContent, TooltipProvider, TooltipTrigger} from "@/components/ui/tooltip";
|
||||
import {cn} from "@/lib/utils";
|
||||
|
||||
export type StatusPillVariant = "default" | "danger" | "pending" | "inprogress" | "departed" | "arrived" | "done";
|
||||
|
||||
const variantClassName: Record<StatusPillVariant, string> = {
|
||||
default: "border-primary/30 bg-primary/10 text-primary",
|
||||
danger: "gwcf-status-badge--danger",
|
||||
pending: "gwcf-status-badge--pending",
|
||||
inprogress: "gwcf-status-badge--inprogress",
|
||||
departed: "gwcf-status-badge--departed",
|
||||
arrived: "gwcf-status-badge--arrived",
|
||||
done: "gwcf-status-badge--done",
|
||||
};
|
||||
|
||||
export function StatusPill({
|
||||
children,
|
||||
onClick,
|
||||
variant = "default",
|
||||
tooltip,
|
||||
}: {
|
||||
children: ReactNode;
|
||||
onClick?: () => void;
|
||||
variant?: StatusPillVariant;
|
||||
tooltip?: ReactNode;
|
||||
}) {
|
||||
const className = cn(
|
||||
"inline-flex min-w-14 items-center justify-center rounded-full border px-2 py-1 text-xs font-semibold",
|
||||
variant !== "default" && "gwcf-status-badge",
|
||||
variantClassName[variant],
|
||||
onClick && "cursor-pointer hover:opacity-80"
|
||||
);
|
||||
|
||||
const handleClick = (event: MouseEvent<HTMLButtonElement>) => {
|
||||
event.stopPropagation();
|
||||
onClick?.();
|
||||
};
|
||||
|
||||
const pill = onClick ? (
|
||||
<button type="button" className={className} onClick={handleClick}>
|
||||
{children || "-"}
|
||||
</button>
|
||||
) : (
|
||||
<span className={className}>
|
||||
{children || "-"}
|
||||
</span>
|
||||
);
|
||||
|
||||
if (!tooltip) return pill;
|
||||
|
||||
return (
|
||||
<TooltipProvider>
|
||||
<Tooltip>
|
||||
<TooltipTrigger asChild>{pill}</TooltipTrigger>
|
||||
<TooltipContent sideOffset={6}>{tooltip}</TooltipContent>
|
||||
</Tooltip>
|
||||
</TooltipProvider>
|
||||
);
|
||||
}
|
||||
Reference in New Issue
Block a user