Skip to content

Commit

Permalink
Delete button doesn't appear for the only block in column
Browse files Browse the repository at this point in the history
  • Loading branch information
silviubogan committed Oct 9, 2020
1 parent 7fcc967 commit b905b92
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/ColumnsBlock/EditBlockWrapper.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ import dragSVG from '@plone/volto/icons/drag.svg';
import addSVG from '@plone/volto/icons/circle-plus.svg';
import trashSVG from '@plone/volto/icons/delete.svg';

import { getColumns } from './utils';

const messages = defineMessages({
unknownBlock: {
id: 'Unknown Block',
Expand Down Expand Up @@ -74,6 +76,8 @@ class EditBlockWrapper extends React.Component {
// const visible = selected && blockHasValue(block) && !block.fixed;
// visibility: visible ? 'visible' : 'hidden',

const showDeleteButton = getColumns(blockProps.properties).length > 1;

const required = isBoolean(data.required)
? data.required
: includes(blocks.requiredBlocks, type);
Expand Down Expand Up @@ -125,7 +129,7 @@ class EditBlockWrapper extends React.Component {
<Icon name={addSVG} className="" size="19px" />
</Button>
)}
{!required && (
{!required && showDeleteButton && (
<Button
icon
basic
Expand Down

0 comments on commit b905b92

Please sign in to comment.