| 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 { align, gap } = props.attributes; |
| 17 |
|
| 18 |
let className = classnames( |
| 19 |
'ghostkit-button-wrapper', |
| 20 |
gap ? `ghostkit-button-wrapper-gap-${gap}` : false, |
| 21 |
align && align !== 'none' |
| 22 |
? `ghostkit-button-wrapper-align-${align}` |
| 23 |
: false |
| 24 |
); |
| 25 |
|
| 26 |
className = applyFilters('ghostkit.blocks.className', className, { |
| 27 |
name, |
| 28 |
...props, |
| 29 |
}); |
| 30 |
|
| 31 |
const blockProps = useBlockProps.save({ |
| 32 |
className, |
| 33 |
}); |
| 34 |
const { children, ...innerBlocksProps } = useInnerBlocksProps.save({ |
| 35 |
className: 'ghostkit-button-wrapper-inner', |
| 36 |
}); |
| 37 |
|
| 38 |
return ( |
| 39 |
<div {...blockProps}> |
| 40 |
<div {...innerBlocksProps}>{children}</div> |
| 41 |
</div> |
| 42 |
); |
| 43 |
} |
| 44 |
|