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

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

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