/** * WordPress dependencies. */ import { RichText, useBlockProps } from '@wordpress/block-editor'; /** * External dependencies. */ import classnames from 'clsx'; /** * Internal dependencies. */ import { Attributes } from './types'; type SaveProps = { readonly className: string; readonly attributes: Attributes; }; const SaveBlock = ( { attributes: { afterAlt, afterId, afterUrl, align = '', beforeAlt, beforeId, beforeUrl, caption = '', isVertical, dividerLocation, }, className, }: SaveProps ): JSX.Element => { const blockProps = useBlockProps.save( { className: classnames( 'wp-block-nelio-compare-images', className, { [ `align${ align }` ]: !! align, } ), } ); return (
{ !! beforeId && ! afterId && ( { ) } { ! beforeId && !! afterId && ( { ) } { !! beforeId && !! afterId && (
{
{
) } { !! beforeId && !! afterId && ! RichText.isEmpty( caption ) && ( ) }
); }; export default SaveBlock;