Skip to content
This repository was archived by the owner on Feb 23, 2024. It is now read-only.

Commit ab38659

Browse files
committed
Change default template to use the core/group block with a row layout.
1 parent 4f65d67 commit ab38659

File tree

5 files changed

+18
-24
lines changed

5 files changed

+18
-24
lines changed

assets/js/atomic/blocks/product-elements/price-v2/edit.tsx

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,11 @@ const EditBlock = ( {
122122
>
123123
<div className={ parentClassName }>
124124
<InnerBlocks
125-
allowedBlocks={ [ originalPriceName, currentPriceName ] }
125+
allowedBlocks={ [
126+
originalPriceName,
127+
currentPriceName,
128+
'core/group',
129+
] }
126130
// todo add template for initial price layout
127131
template={ TEMPLATE }
128132
/>

assets/js/atomic/blocks/product-elements/price-v2/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ import { registerBlockType } from '@wordpress/blocks';
88
*/
99
import sharedConfig from '../shared/config';
1010
import edit from './edit';
11-
import { save } from './save';
11+
import save from './save';
1212
import attributes from './attributes';
1313
import { supports } from './supports';
1414
import {
Lines changed: 4 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,8 @@
11
/**
22
* External dependencies
33
*/
4-
import classnames from 'classnames';
4+
import { useInnerBlocksProps, useBlockProps } from '@wordpress/block-editor';
55

6-
export const save = ( { attributes } ) => {
7-
if (
8-
attributes.isDescendentOfSingleProductBlock ||
9-
attributes.isDescendentOfSingleProductTemplate
10-
) {
11-
return null;
12-
}
13-
14-
return (
15-
<div className={ classnames( 'is-loading', attributes.className ) } />
16-
);
17-
};
6+
export default function save() {
7+
return <div { ...useInnerBlocksProps.save( useBlockProps.save() ) } />;
8+
}

assets/js/atomic/blocks/product-elements/price-v2/style.scss

Lines changed: 0 additions & 7 deletions
This file was deleted.

assets/js/atomic/blocks/product-elements/price-v2/template.ts

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,12 @@
44
import { InnerBlockTemplate } from '@wordpress/blocks';
55

66
export const TEMPLATE: InnerBlockTemplate[] = [
7-
[ 'woocommerce/original-price', {}, [] ],
8-
[ 'woocommerce/current-price', {}, [] ],
7+
[
8+
'core/group',
9+
{ layout: { type: 'flex', flexWrap: 'nowrap' } },
10+
[
11+
[ 'woocommerce/original-price', {}, [] ],
12+
[ 'woocommerce/current-price', {}, [] ],
13+
],
14+
],
915
];

0 commit comments

Comments
 (0)