Skip to content

Commit

Permalink
[Block Library - Columns] Fix deprecation caused when adding a column (
Browse files Browse the repository at this point in the history
  • Loading branch information
ntsekouras authored Jun 10, 2021
1 parent 6530dfc commit 3c722bf
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion packages/block-library/src/columns/edit.js
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,7 @@ const ColumnsEditContainerWrapper = withDispatch(
...getMappedColumnWidths( innerBlocks, widths ),
...times( newColumns - previousColumns, () => {
return createBlock( 'core/column', {
width: newColumnWidth,
width: `${ newColumnWidth }%`,
} );
} ),
];
Expand Down
2 changes: 1 addition & 1 deletion packages/block-library/src/columns/edit.native.js
Original file line number Diff line number Diff line change
Expand Up @@ -381,7 +381,7 @@ const ColumnsEditContainerWrapper = withDispatch(
...getMappedColumnWidths( innerBlocks, widths ),
...times( newColumns - previousColumns, () => {
return createBlock( 'core/column', {
width: newColumnWidth,
width: `${ newColumnWidth }%`,
verticalAlignment,
} );
} ),
Expand Down
4 changes: 2 additions & 2 deletions packages/block-library/src/columns/test/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -276,8 +276,8 @@ describe( 'getMappedColumnWidths', () => {
const result = getMappedColumnWidths( blocks, widths );

expect( result ).toEqual( [
{ clientId: 'a', attributes: { width: 25 } },
{ clientId: 'b', attributes: { width: 35 } },
{ clientId: 'a', attributes: { width: '25%' } },
{ clientId: 'b', attributes: { width: '35%' } },
] );
} );
} );
2 changes: 1 addition & 1 deletion packages/block-library/src/columns/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ export function getMappedColumnWidths( blocks, widths ) {
return blocks.map( ( block ) =>
merge( {}, block, {
attributes: {
width: widths[ block.clientId ],
width: `${ widths[ block.clientId ] }%`,
},
} )
);
Expand Down

0 comments on commit 3c722bf

Please sign in to comment.