| 1 |
import classnames from 'classnames/dedupe'; |
| 2 |
|
| 3 |
import metadata from './block.json'; |
| 4 |
|
| 5 |
const { name } = metadata; |
| 6 |
|
| 7 |
import { useBlockProps, useInnerBlocksProps } from '@wordpress/block-editor'; |
| 8 |
import { applyFilters } from '@wordpress/hooks'; |
| 9 |
|
| 10 |
/** |
| 11 |
* Block Save Class. |
| 12 |
* |
| 13 |
* @param props |
| 14 |
*/ |
| 15 |
export default function BlockSave(props) { |
| 16 |
const { slug, active } = props.attributes; |
| 17 |
|
| 18 |
let className = classnames('ghostkit-tab', active && 'ghostkit-tab-active'); |
| 19 |
|
| 20 |
className = applyFilters('ghostkit.blocks.className', className, { |
| 21 |
...{ name }, |
| 22 |
...props, |
| 23 |
}); |
| 24 |
|
| 25 |
const blockProps = useBlockProps.save({ |
| 26 |
className, |
| 27 |
tabIndex: 0, |
| 28 |
role: 'tabpanel', |
| 29 |
'aria-labelledby': `${slug}-button`, |
| 30 |
'data-tab': slug, |
| 31 |
}); |
| 32 |
const innerBlockProps = useInnerBlocksProps.save(blockProps); |
| 33 |
|
| 34 |
return <div {...innerBlockProps} />; |
| 35 |
} |
| 36 |
|