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-single / index.js

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

67 lines 1.8 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 deprecated from './deprecated';
4 import edit from './edit';
5 import save from './save';
6
7 const { name } = metadata;
8
9 export { metadata, name };
10
11 export const settings = {
12 icon: getIcon('block-button', true),
13 ghostkit: {
14 customStylesCallback(attributes) {
15 const styles = {
16 '--gkt-button__background-color': attributes.color || undefined,
17 '--gkt-button__color': attributes.textColor || undefined,
18 '--gkt-button__border-radius': undefined,
19 '--gkt-button__border-width': undefined,
20 '--gkt-button__border-color':
21 attributes.borderColor || undefined,
22 '--gkt-button-hover__background-color':
23 attributes.hoverColor || undefined,
24 '--gkt-button-hover__color':
25 attributes.hoverTextColor || undefined,
26 '--gkt-button-hover__border-color':
27 attributes.hoverBorderColor || undefined,
28 '--gkt-button-focus__background-color':
29 attributes.hoverColor || undefined,
30 '--gkt-button-focus__color':
31 attributes.hoverTextColor || undefined,
32 '--gkt-button-focus__box-shadow': undefined,
33 };
34
35 // Border.
36 if (
37 typeof attributes.borderRadius !== 'undefined' &&
38 attributes.borderRadius !== ''
39 ) {
40 styles['--gkt-button__border-radius'] =
41 `${attributes.borderRadius}px`;
42 }
43 if (
44 typeof attributes.borderWeight !== 'undefined' &&
45 attributes.borderWeight !== ''
46 ) {
47 styles['--gkt-button__border-width'] =
48 `${attributes.borderWeight}px`;
49 }
50
51 // Box Shadow.
52 if (
53 typeof attributes.focusOutlineWeight !== 'undefined' &&
54 attributes.focusOutlineColor
55 ) {
56 styles['--gkt-button-focus__box-shadow'] =
57 `0 0 0 ${attributes.focusOutlineWeight}px ${attributes.focusOutlineColor}`;
58 }
59
60 return styles;
61 },
62 },
63 edit,
64 save,
65 deprecated,
66 };
67