Allow removing board component from column action
This commit is contained in:
1 parent
b816e951a5
commit
903cccee7c
1 file changed
+14
-3
@@ -48,6 +48,17 @@ export function BoardColumn({
|
|||||||
setShowSelect(false);
|
setShowSelect(false);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const hasComponent = !!component;
|
||||||
|
const canRemoveAction = hasComponent || canRemove;
|
||||||
|
|
||||||
|
const handleRemove = () => {
|
||||||
|
if (hasComponent) {
|
||||||
|
onSetComponent?.(id, null);
|
||||||
|
} else {
|
||||||
|
onRemove?.(id);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Column
|
<Column
|
||||||
width="100%"
|
width="100%"
|
||||||
@@ -58,7 +69,7 @@ export function BoardColumn({
|
|||||||
position="relative"
|
position="relative"
|
||||||
className={styles.column}
|
className={styles.column}
|
||||||
>
|
>
|
||||||
{editing && canRemove && (
|
{editing && canRemoveAction && (
|
||||||
<Box
|
<Box
|
||||||
className={styles.columnAction}
|
className={styles.columnAction}
|
||||||
position="absolute"
|
position="absolute"
|
||||||
@@ -67,12 +78,12 @@ export function BoardColumn({
|
|||||||
zIndex={100}
|
zIndex={100}
|
||||||
>
|
>
|
||||||
<TooltipTrigger delay={0}>
|
<TooltipTrigger delay={0}>
|
||||||
<Button variant="outline" onPress={() => onRemove?.(id)}>
|
<Button variant="outline" onPress={handleRemove} isDisabled={!canRemoveAction}>
|
||||||
<Icon size="sm">
|
<Icon size="sm">
|
||||||
<X />
|
<X />
|
||||||
</Icon>
|
</Icon>
|
||||||
</Button>
|
</Button>
|
||||||
<Tooltip>Remove column</Tooltip>
|
<Tooltip>{hasComponent ? 'Remove component' : 'Remove column'}</Tooltip>
|
||||||
</TooltipTrigger>
|
</TooltipTrigger>
|
||||||
</Box>
|
</Box>
|
||||||
)}
|
)}
|
||||||
|
|||||||
Reference in new issue
Block a user