| 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 |
import getColClass from './get-col-class'; |
| 8 |
|
| 9 |
const { name } = metadata; |
| 10 |
|
| 11 |
/** |
| 12 |
* Block Save Class. |
| 13 |
* |
| 14 |
* @param props |
| 15 |
*/ |
| 16 |
export default function BlockSave(props) { |
| 17 |
let className = getColClass(props); |
| 18 |
|
| 19 |
// background |
| 20 |
const background = applyFilters( |
| 21 |
'ghostkit.blocks.grid-column.background', |
| 22 |
'', |
| 23 |
{ |
| 24 |
name, |
| 25 |
...props, |
| 26 |
} |
| 27 |
); |
| 28 |
|
| 29 |
if (background) { |
| 30 |
className = classnames(className, 'ghostkit-col-with-bg'); |
| 31 |
} |
| 32 |
|
| 33 |
const blockProps = useBlockProps.save({ |
| 34 |
className, |
| 35 |
}); |
| 36 |
const innerBlocksProps = useInnerBlocksProps.save({ |
| 37 |
className: 'ghostkit-col-content', |
| 38 |
}); |
| 39 |
|
| 40 |
return ( |
| 41 |
<div {...blockProps}> |
| 42 |
{background} |
| 43 |
<div {...innerBlocksProps} /> |
| 44 |
</div> |
| 45 |
); |
| 46 |
} |
| 47 |
|