Skip to content

Commit

Permalink
Fix values issue with Gap box control by passing in top/right/bottom/…
Browse files Browse the repository at this point in the history
…left values from row/column style values
  • Loading branch information
andrewserong committed Aug 5, 2021
1 parent 59b6f06 commit 69ba2b9
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 6 deletions.
11 changes: 6 additions & 5 deletions packages/block-editor/src/hooks/dimensions.js
Original file line number Diff line number Diff line change
Expand Up @@ -106,13 +106,14 @@ export function DimensionsPanel( props ) {
</ToolsPanelItem>
) }
{ ! isGapDisabled && (
<GapEdit
{ ...props }
hasValue={ hasGapValue }
<ToolsPanelItem
hasValue={ () => hasGapValue( props ) }
label={ __( 'Gap' ) }
reset={ resetGap }
onDeselect={ () => resetGap( props ) }
isShownByDefault={ defaultSpacingControls?.gap }
/>
>
<GapEdit { ...props } />
</ToolsPanelItem>
) }
</ToolsPanel>
</InspectorControls>
Expand Down
9 changes: 8 additions & 1 deletion packages/block-editor/src/hooks/gap.js
Original file line number Diff line number Diff line change
Expand Up @@ -126,11 +126,18 @@ export function GapEdit( props ) {
} );
};

const boxValues = {
top: style?.spacing?.gap?.row,
right: style?.spacing.gap?.column,
bottom: style?.spacing.gap?.row,
left: style?.spacing.gap?.column,
};

return Platform.select( {
web: (
<>
<BoxControl
values={ style?.spacing?.gap }
values={ boxValues }
onChange={ onChange }
onChangeShowVisualizer={ onChangeShowVisualizer }
label={ __( 'Gap' ) }
Expand Down

0 comments on commit 69ba2b9

Please sign in to comment.