PluginProbe
Block Animations, Motion & Scroll Effects – Ghost Kit / 2.25.0
Block Animations, Motion & Scroll Effects – Ghost Kit v2.25.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 / grid / save.js

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

70 lines 1.5 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 /**
2 * External dependencies
3 */
4 import classnames from 'classnames/dedupe';
5
6 /**
7 * Internal dependencies
8 */
9 import metadata from './block.json';
10
11 /**
12 * WordPress dependencies
13 */
14 const { applyFilters } = wp.hooks;
15
16 const {
17 useBlockProps,
18 useInnerBlocksProps: __stableUseInnerBlocksProps,
19 __experimentalUseInnerBlocksProps,
20 } = wp.blockEditor;
21
22 const { name } = metadata;
23
24 const useInnerBlocksProps = __stableUseInnerBlocksProps || __experimentalUseInnerBlocksProps;
25
26 /**
27 * Block Save Class.
28 */
29 export default function BlockSave(props) {
30 const { verticalAlign, horizontalAlign, gap } = props.attributes;
31
32 let className = classnames(
33 'ghostkit-grid',
34 `ghostkit-grid-gap-${gap}`,
35 verticalAlign ? `ghostkit-grid-align-items-${verticalAlign}` : false,
36 horizontalAlign ? `ghostkit-grid-justify-content-${horizontalAlign}` : false
37 );
38
39 // background
40 const background = applyFilters('ghostkit.blocks.grid.background', '', {
41 ...{
42 name,
43 },
44 ...props,
45 });
46
47 if (background) {
48 className = classnames(className, 'ghostkit-grid-with-bg');
49 }
50
51 className = applyFilters('ghostkit.blocks.className', className, {
52 ...{
53 name,
54 },
55 ...props,
56 });
57
58 const blockProps = useBlockProps.save({
59 className,
60 });
61 const { children, ...innerBlocksProps } = useInnerBlocksProps.save(blockProps);
62
63 return (
64 <div {...innerBlocksProps}>
65 {background}
66 <div className="ghostkit-grid-inner">{children}</div>
67 </div>
68 );
69 }
70