File "save.js"

Full Path: /home/rattkxnv/byattorney.com/wp-content/plugins/generateblocks/src/blocks/media/save.js
File size: 734 bytes
MIME-type: text/x-java
Charset: utf-8

/**
 * WordPress dependencies
 */
import { getBlockClasses } from '@utils/getBlockClasses';
import { useInnerBlocksProps, useBlockProps } from '@wordpress/block-editor';

export function Save( { attributes } ) {
	const {
		tagName: Tag,
		htmlAttributes = {},
		linkHtmlAttributes = {},
	} = attributes;

	const classNames = getBlockClasses(
		'gb-media',
		attributes,
	);

	const blockProps = useBlockProps.save(
		{
			className: classNames.join( ' ' ).trim(),
			...htmlAttributes,
		}
	);

	return (
		<>
			{ !! linkHtmlAttributes.href ? (
				<a { ...linkHtmlAttributes }>
					<Tag { ...useInnerBlocksProps.save( blockProps ) } />
				</a>
			) : (
				<Tag { ...useInnerBlocksProps.save( blockProps ) } />
			) }
		</>
	);
}