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