Skip to content

Commit

Permalink
fix remove baseline and isDeletable (allow comparison of 1 item)
Browse files Browse the repository at this point in the history
  • Loading branch information
gtarpenning committed Dec 10, 2024
1 parent 366ea7b commit ed1a27d
Showing 1 changed file with 7 additions and 15 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ export const DraggableItem = SortableElement(
onRemoveItem,
onSetBaseline,
}: DraggableItemProps) => {
const isDeletable = numItems > 2;
const isDeletable = numItems > 1;
const isBaseline = idx === 0;
const [isOpen, setIsOpen] = useState(false);

Expand Down Expand Up @@ -72,20 +72,12 @@ export const DraggableItem = SortableElement(
</DropdownMenu.Trigger>
<DropdownMenu.Portal>
<DropdownMenu.Content align="start">
{isBaseline ? (
<DropdownMenu.Item
onClick={() => {
onSetBaseline(null);
}}>
<Icon name="baseline-alt" />
Remove baseline
</DropdownMenu.Item>
) : (
<DropdownMenu.Item onClick={onMakeBaselinePropagated}>
<Icon name="baseline-alt" />
Make baseline
</DropdownMenu.Item>
)}
<DropdownMenu.Item
onClick={onMakeBaselinePropagated}
disabled={isBaseline}>
<Icon name="baseline-alt" />
Make baseline
</DropdownMenu.Item>
{isDeletable && (
<>
<DropdownMenu.Separator />
Expand Down

0 comments on commit ed1a27d

Please sign in to comment.