PluginProbe
Block Animations, Motion & Scroll Effects – Ghost Kit / 3.3.3
Block Animations, Motion & Scroll Effects – Ghost Kit v3.3.3
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 / button / index.js

index.js in Block Animations, Motion & Scroll Effects – Ghost Kit 3.3.3, at gutenberg/blocks/button/index.js

83 lines 2.3 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 import getIcon from '../../utils/get-icon';
2 import metadata from './block.json';
3 import edit from './edit';
4 import save from './save';
5 import transforms from './transforms';
6
7 const { name } = metadata;
8
9 export { metadata, name };
10
11 export const settings = {
12 icon: getIcon('block-buttons', true),
13 ghostkit: {
14 previewUrl: 'https://www.ghostkit.io/docs/blocks/button/',
15 customStylesCallback(attributes) {
16 const { gap, gapCustom, gapVerticalCustom } = attributes;
17
18 const styles = {
19 '--gkt-button__gap': undefined,
20 '--gkt-button__gap-vertical': undefined,
21 };
22
23 // Custom Gap.
24 if (gap === 'custom') {
25 if (typeof gapCustom !== 'undefined') {
26 // we need to use `%` unit because of conflict with complex calc() and 0 value.
27 const unit = gapCustom ? 'px' : '%';
28
29 styles['--gkt-button__gap'] = `${gapCustom}${unit}`;
30 }
31
32 if (typeof gapVerticalCustom !== 'undefined') {
33 // we need to use `%` unit because of conflict with complex calc() and 0 value.
34 const unit = gapVerticalCustom ? 'px' : '%';
35
36 styles['--gkt-button__gap-vertical'] =
37 `${gapVerticalCustom}${unit}`;
38 }
39 }
40
41 return styles;
42 },
43 },
44 example: {
45 attributes: {
46 count: 2,
47 align: 'center',
48 gap: 'lg',
49 },
50 innerBlocks: [
51 {
52 name: 'ghostkit/button-single',
53 attributes: {
54 text: 'Button 1',
55 size: 'xl',
56 color: '#0366d6',
57 ghostkit: {
58 id: 'example-button-1',
59 },
60 className: 'ghostkit-custom-example-button-1',
61 },
62 },
63 {
64 name: 'ghostkit/button-single',
65 attributes: {
66 text: 'Button 2',
67 size: 'xl',
68 color: '#2F1747',
69 icon: '<svg class="ghostkit-svg-icon" width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M16.7813 9.75C16.7813 7.10939 14.6406 4.96875 12 4.96875C9.35939 4.96875 7.21875 7.10939 7.21875 9.75C7.21875 12.3906 9.35939 14.5312 12 14.5312C14.6406 14.5312 16.7813 12.3906 16.7813 9.75Z" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"/><path d="M8.15625 18C10.6023 19.25 13.3977 19.25 15.8437 18" stroke="currentColor" stroke-width="1.5" stroke-linecap="round"/></svg>',
70 borderRadius: 50,
71 ghostkit: {
72 id: 'example-button-2',
73 },
74 className: 'ghostkit-custom-example-button-2',
75 },
76 },
77 ],
78 },
79 edit,
80 save,
81 transforms,
82 };
83