Skip to content

Commit 556a6b9

Browse files
committed
feat: update kanban
1 parent 5d22de9 commit 556a6b9

File tree

2 files changed

+11
-10
lines changed

2 files changed

+11
-10
lines changed

docs/registry/default/example/kanban-demo.tsx

+2-2
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,8 @@ export default function KanbanDemo() {
2222
{ id: "5", title: "Implement dark mode", priority: "medium" },
2323
],
2424
done: [
25-
// { id: "6", title: "Setup project", priority: "high" },
26-
// { id: "7", title: "Initial commit", priority: "low" },
25+
{ id: "6", title: "Setup project", priority: "high" },
26+
{ id: "7", title: "Initial commit", priority: "low" },
2727
],
2828
});
2929

docs/registry/default/ui/kanban.tsx

+9-8
Original file line numberDiff line numberDiff line change
@@ -495,11 +495,12 @@ interface KanbanColumnProps extends SlotProps {
495495
value: UniqueIdentifier;
496496
children: React.ReactNode;
497497
asChild?: boolean;
498+
disabled?: boolean;
498499
}
499500

500501
const KanbanColumn = React.forwardRef<HTMLDivElement, KanbanColumnProps>(
501502
(props, forwardedRef) => {
502-
const { value, asChild, className, ...columnProps } = props;
503+
const { value, asChild, disabled, className, ...columnProps } = props;
503504

504505
const context = useKanbanContext("column");
505506
const inBoard = React.useContext(KanbanBoardContext);
@@ -513,6 +514,7 @@ const KanbanColumn = React.forwardRef<HTMLDivElement, KanbanColumnProps>(
513514

514515
const { setNodeRef } = useDroppable({
515516
id: value,
517+
disabled,
516518
});
517519

518520
const ColumnSlot = asChild ? Slot : "div";
@@ -522,20 +524,19 @@ const KanbanColumn = React.forwardRef<HTMLDivElement, KanbanColumnProps>(
522524
return items.map((item) => context.getItemValue(item));
523525
}, [context.items, value, context.getItemValue]);
524526

525-
const composedRef = useComposedRefs(
526-
forwardedRef,
527-
(node: HTMLDivElement | null) => {
528-
if (node) setNodeRef(node);
529-
},
530-
);
527+
const composedRef = useComposedRefs(forwardedRef, (node) => {
528+
if (disabled) return;
529+
setNodeRef(node);
530+
});
531531

532532
return (
533533
<SortableContext strategy={context.strategy} items={items}>
534534
<ColumnSlot
535+
aria-disabled={disabled}
535536
{...columnProps}
536537
ref={composedRef}
537538
className={cn(
538-
"flex size-full flex-col gap-2 rounded-lg border bg-zinc-100 p-4 dark:bg-zinc-900",
539+
"flex size-full flex-col gap-2 rounded-lg border bg-zinc-100 p-4 aria-disabled:pointer-events-none aria-disabled:opacity-50 dark:bg-zinc-900",
539540
className,
540541
)}
541542
/>

0 commit comments

Comments
 (0)