/
index.js
70 lines (65 loc) · 1.96 KB
/
index.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
/**
* Registers a new block variation provided a unique name and an object defining its behavior.
*
* @see https://developer.wordpress.org/block-editor/packages/packages-blocks/#registerBlockVariation
*/
import { registerBlockVariation } from '@wordpress/blocks';
/**
* Retrieves the translation of text.
*
* @see https://developer.wordpress.org/block-editor/packages/packages-i18n/
*/
import { __ } from '@wordpress/i18n';
/**
* Variation content
*/
const CONTENT = [
// We'll write our variation here.
[ 'core/heading', {
textAlign: 'center',
placeholder: 'Write a heading about callouts here'
} ],
[ 'core/columns', {"verticalAlignment":"center","align":"wide"}, [
['core/column', {}, [
[ 'core/image' ],
[ 'core/heading', {"textAlign":"center","level":3} ],
[ 'core/paragraph', {"align":"center"} ],
[ 'core/buttons', {"contentJustification":"center"}, [
[ 'core/button' ]
] ]
] ],
['core/column', {}, [
[ 'core/image' ],
[ 'core/heading', {"textAlign":"center","level":3} ],
[ 'core/paragraph', {"align":"center"} ],
[ 'core/buttons', {"contentJustification":"center"}, [
[ 'core/button' ]
] ]
] ],
['core/column', {}, [
[ 'core/image' ],
[ 'core/heading', {"textAlign":"center","level":3} ],
[ 'core/paragraph', {"align":"center"} ],
[ 'core/buttons', {"contentJustification":"center"}, [
[ 'core/button' ]
] ]
] ],
] ],
];
/*
* New `core/group` block variation.
*/
const variationsExample = {
name: 'variations-example',
title: __( 'Callout Variations Example', 'variations-example' ),
description: __( 'Sets up a three column callout structure.', 'variations-example' ),
scope: [ 'inserter' ],
attributes: {"align":"full","style":{"spacing":{"padding":{"top":"60px","right":"60px","bottom":"60px","left":"60px"}}},"gradient":"red-to-purple"},
icon: {
background: '#000',
foreground: '#fff',
src: 'layout'
},
innerBlocks: CONTENT,
};
registerBlockVariation( 'core/group', variationsExample );