Skip to content

Commit 1bd276b

Browse files
committed
substitute: hero, icon, imageBox, pricingBox
1 parent fcf481d commit 1bd276b

File tree

4 files changed

+51
-14
lines changed

4 files changed

+51
-14
lines changed

src/block/hero/substitute.js

Lines changed: 1 addition & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,12 @@
11
export const substitute = {
22
from: 'stackable/hero',
3-
variants: [ 'stackable/hero' ],
4-
to: [ 'stackable/columns' ],
53
transform: ( oldAttributes, innerBlocks ) => {
64
return [
75
'stackable/columns',
86
{
9-
// TODO: See if passing the entire oldAttributes works.
107
...oldAttributes,
11-
// hasBackground: oldAttributes.hasBackground,
12-
// blockBackgroundMediaUrl: oldAttributes.blockBackgroundMediaUrl,
13-
// align: oldAttributes.align,
14-
// contentAlign: oldAttributes.contentAlign,
15-
// innerBlockContentAlign: oldAttributes.innerBlockContentAlign,
16-
// blockHeight: oldAttributes.blockHeight,
17-
// blockVerticalAlign: oldAttributes.blockVerticalAlign,
18-
// hasContainer: oldAttributes.hasContainer,
198
},
20-
[ 'stackable/column', {}, innerBlocks ],
9+
[ [ 'stackable/column', {}, innerBlocks ] ],
2110
]
2211
},
2312
}

src/block/icon/substitute.js

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,14 @@
1-
// TODO: this results in an error. test with Blooom Service 1 design
21
export const substitute = {
32
from: 'stackable/icon',
4-
to: [ 'core/paragraph' ],
3+
transform: () => {
4+
return [
5+
'core/paragraph',
6+
{
7+
content: '',
8+
},
9+
]
10+
},
11+
512
}
613

714
export default substitute

src/block/image-box/substitute.js

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
export const substitute = {
2+
from: 'stackable/image-box',
3+
transform: ( oldAttributes, innerBlocks ) => {
4+
const imageUrl = innerBlocks[ 0 ][ 1 ]?.imageUrl
5+
const imageHeight = innerBlocks[ 0 ][ 1 ]?.imageHeight
6+
7+
innerBlocks = innerBlocks.filter( block => ! [ 'stackable/image', 'core/image' ].includes( block[ 0 ] ) )
8+
9+
return [
10+
'stackable/columns',
11+
{
12+
...oldAttributes,
13+
hasBackground: true,
14+
blockBackgroundMediaUrl: imageUrl,
15+
blockPadding: {
16+
top: imageHeight,
17+
right: 0,
18+
bottom: 0,
19+
left: 0,
20+
},
21+
},
22+
innerBlocks,
23+
]
24+
},
25+
}
26+
27+
export default substitute
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
export const substitute = {
2+
from: 'stackable/pricing-box',
3+
transform: ( oldAttributes, innerBlocks ) => {
4+
return [
5+
'stackable/columns',
6+
{
7+
...oldAttributes,
8+
},
9+
[ [ 'stackable/column', {}, innerBlocks ] ],
10+
]
11+
},
12+
}
13+
14+
export default substitute

0 commit comments

Comments
 (0)