forked from Kiranism/next-shadcn-dashboard-starter
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathutils.ts
29 lines (23 loc) · 724 Bytes
/
utils.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
import { type ClassValue, clsx } from "clsx";
import { twMerge } from "tailwind-merge";
import { Active, DataRef, Over } from "@dnd-kit/core";
import { ColumnDragData } from "@/components/kanban/board-column";
import { TaskDragData } from "@/components/kanban/task-card";
type DraggableData = ColumnDragData | TaskDragData;
export function cn(...inputs: ClassValue[]) {
return twMerge(clsx(inputs));
}
export function hasDraggableData<T extends Active | Over>(
entry: T | null | undefined,
): entry is T & {
data: DataRef<DraggableData>;
} {
if (!entry) {
return false;
}
const data = entry.data.current;
if (data?.type === "Column" || data?.type === "Task") {
return true;
}
return false;
}