PluginProbe
Block Animations, Motion & Scroll Effects – Ghost Kit / 3.7.0
Block Animations, Motion & Scroll Effects – Ghost Kit v3.7.0
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 / save.js

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

74 lines 1.4 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 import classnames from 'classnames/dedupe';
2
3 import metadata from './block.json';
4
5 const { name } = metadata;
6
7 import { RichText, useBlockProps } from '@wordpress/block-editor';
8 import { applyFilters } from '@wordpress/hooks';
9
10 /**
11 * Block Save Class.
12 *
13 * @param props
14 */
15 export default function BlockSave(props) {
16 const {
17 caption,
18 percent,
19 striped,
20 showCount,
21 countPrefix,
22 countSuffix,
23 animateInViewport,
24 } = props.attributes;
25
26 let className = 'ghostkit-progress';
27
28 className = applyFilters('ghostkit.blocks.className', className, {
29 name,
30 ...props,
31 });
32
33 const blockProps = useBlockProps.save({ className });
34
35 return (
36 <div {...blockProps}>
37 {!RichText.isEmpty(caption) ? (
38 <div className="ghostkit-progress-caption">
39 <RichText.Content value={caption} />
40 </div>
41 ) : null}
42 {showCount ? (
43 <div
44 className="ghostkit-progress-bar-count"
45 style={{ width: `${percent}%` }}
46 >
47 <div>
48 <span>{countPrefix}</span>
49 <span>{percent}</span>
50 <span>{countSuffix}</span>
51 </div>
52 </div>
53 ) : null}
54 <div
55 className={classnames(
56 'ghostkit-progress-wrap',
57 striped && 'ghostkit-progress-bar-striped'
58 )}
59 >
60 <div
61 className={classnames(
62 'ghostkit-progress-bar',
63 animateInViewport && 'ghostkit-count-up'
64 )}
65 role="progressbar"
66 aria-valuenow={percent}
67 aria-valuemin="0"
68 aria-valuemax="100"
69 />
70 </div>
71 </div>
72 );
73 }
74