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 / countdown / save.js

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

55 lines 1.2 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 { useBlockProps, useInnerBlocksProps } from '@wordpress/block-editor';
4 import { applyFilters } from '@wordpress/hooks';
5
6 import metadata from './block.json';
7
8 const { name } = metadata;
9
10 /**
11 * Block Save Class.
12 *
13 * @param props
14 */
15 export default function BlockSave(props) {
16 const { attributes } = props;
17
18 const { date, units, unitsAlign } = attributes;
19
20 let className = classnames(
21 'ghostkit-countdown',
22 unitsAlign && `ghostkit-countdown-units-align-${unitsAlign}`
23 );
24
25 className = applyFilters('ghostkit.blocks.className', className, {
26 name,
27 ...props,
28 });
29
30 const blockProps = useBlockProps.save({ className, 'data-date': date });
31 const innerBlockProps = useInnerBlocksProps.save({
32 className: 'ghostkit-countdown-expire-action',
33 });
34
35 return (
36 <div {...blockProps}>
37 {units.map((unitName) => (
38 <div
39 key={unitName}
40 className={classnames(
41 'ghostkit-countdown-unit',
42 `ghostkit-countdown-unit-${unitName}`
43 )}
44 >
45 <span className="ghostkit-countdown-unit-number">00</span>
46 <span className="ghostkit-countdown-unit-label">
47 {unitName}
48 </span>
49 </div>
50 ))}
51 <div {...innerBlockProps} />
52 </div>
53 );
54 }
55