PluginProbe
Block Animations, Motion & Scroll Effects – Ghost Kit / 3.4.1
Block Animations, Motion & Scroll Effects – Ghost Kit v3.4.1
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.4.1, at gutenberg/blocks/grid/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 { verticalAlign, horizontalAlign, gap } = props.attributes;
17
18 let className = classnames(
19 'ghostkit-grid',
20 `ghostkit-grid-gap-${gap}`,
21 verticalAlign ? `ghostkit-grid-align-items-${verticalAlign}` : false,
22 horizontalAlign
23 ? `ghostkit-grid-justify-content-${horizontalAlign}`
24 : false
25 );
26
27 // background
28 const background = applyFilters('ghostkit.blocks.grid.background', '', {
29 name,
30 ...props,
31 });
32
33 if (background) {
34 className = classnames(className, 'ghostkit-grid-with-bg');
35 }
36
37 className = applyFilters('ghostkit.blocks.className', className, {
38 name,
39 ...props,
40 });
41
42 const blockProps = useBlockProps.save({
43 className,
44 });
45 const { children, ...innerBlocksProps } =
46 useInnerBlocksProps.save(blockProps);
47
48 return (
49 <div {...innerBlocksProps}>
50 {background}
51 <div className="ghostkit-grid-inner">{children}</div>
52 </div>
53 );
54 }
55