@wordpress/block-library
Version:
Block library for the WordPress editor.
32 lines (28 loc) • 691 B
JavaScript
/**
* External dependencies
*/
import classnames from 'classnames';
/**
* WordPress dependencies
*/
import { RichText, useBlockProps } from '@wordpress/block-editor';
export default function save( { attributes } ) {
const { textAlign, citation, value } = attributes;
const shouldShowCitation = ! RichText.isEmpty( citation );
return (
<figure
{ ...useBlockProps.save( {
className: classnames( {
[ `has-text-align-${ textAlign }` ]: textAlign,
} ),
} ) }
>
<blockquote>
<RichText.Content tagName="p" value={ value } />
{ shouldShowCitation && (
<RichText.Content tagName="cite" value={ citation } />
) }
</blockquote>
</figure>
);
}