PluginProbe
Block Animations, Motion & Scroll Effects – Ghost Kit / 3.3.2
Block Animations, Motion & Scroll Effects – Ghost Kit v3.3.2
3.7.2 3.7.1 3.7.0 3.6.1 trunk 1.6.3 2.25.0 3.3.0 3.3.1 3.3.2 3.3.3 3.4.0 3.4.1 3.4.2 3.4.3 3.4.4 3.4.5 3.4.6 3.5.0 3.5.1 3.6.0
ghostkit / gutenberg / blocks / accordion / transforms.js

transforms.js in Block Animations, Motion & Scroll Effects – Ghost Kit 3.3.2, at gutenberg/blocks/accordion/transforms.js

36 lines 711 B
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 import { createBlock } from '@wordpress/blocks';
2 import { __ } from '@wordpress/i18n';
3
4 export default {
5 from: [
6 {
7 type: 'block',
8 blocks: ['ghostkit/tabs-v2'],
9 transform(attrs, innerBlocks) {
10 const { tabsData, tabActive } = attrs;
11
12 return createBlock(
13 'ghostkit/accordion',
14 {
15 itemsCount: innerBlocks.length,
16 },
17 innerBlocks.map((tab, i) =>
18 createBlock(
19 'ghostkit/accordion-item',
20 {
21 heading: tabsData[i]
22 ? tabsData[i].title
23 : __('Accordion Item', 'ghostkit'),
24 active: tabsData[i]
25 ? tabsData[i].slug === tabActive
26 : false,
27 },
28 tab.innerBlocks
29 )
30 )
31 );
32 },
33 },
34 ],
35 };
36