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

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

65 lines 1.6 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
6 const { name } = metadata;
7
8 export { metadata, name };
9
10 export const settings = {
11 icon: getIcon('block-progress', true),
12 ghostkit: {
13 previewUrl: 'https://www.ghostkit.io/docs/blocks/progress/',
14 customStylesCallback(attributes) {
15 const styles = {
16 '--gkt-progress__height': undefined,
17 '--gkt-progress__border-radius': undefined,
18 '--gkt-progress__background-color':
19 attributes.backgroundColor || undefined,
20 '--gkt-progress--bar__width': undefined,
21 '--gkt-progress--bar__background-color':
22 attributes.color || undefined,
23 '&:hover': {
24 '--gkt-progress--bar__background-color':
25 attributes.hoverColor || undefined,
26 '--gkt-progress__background-color':
27 attributes.hoverBackgroundColor || undefined,
28 },
29 };
30
31 if (
32 typeof attributes.height !== 'undefined' &&
33 attributes.height !== ''
34 ) {
35 styles['--gkt-progress__height'] = `${attributes.height}px`;
36 }
37 if (
38 typeof attributes.borderRadius !== 'undefined' &&
39 attributes.borderRadius !== ''
40 ) {
41 styles['--gkt-progress__border-radius'] =
42 `${attributes.borderRadius}px`;
43 }
44 if (
45 typeof attributes.percent !== 'undefined' &&
46 attributes.percent !== ''
47 ) {
48 styles['--gkt-progress--bar__width'] = `${attributes.percent}%`;
49 }
50
51 return styles;
52 },
53 },
54 example: {
55 attributes: {
56 ghostkit: {
57 id: 'example-progress',
58 },
59 className: 'ghostkit-custom-example-progress',
60 },
61 },
62 edit,
63 save,
64 };
65