2023-05-26 12:16:57 +00:00
|
|
|
/**
|
|
|
|
* External dependencies
|
|
|
|
*/
|
|
|
|
import type { BlockAttributes } from '@wordpress/blocks';
|
2023-12-07 19:12:18 +00:00
|
|
|
import { useWooBlockProps } from '@woocommerce/block-templates';
|
2023-05-26 12:16:57 +00:00
|
|
|
import { createElement } from '@wordpress/element';
|
|
|
|
|
|
|
|
/**
|
|
|
|
* The edit function describes the structure of your block in the context of the
|
|
|
|
* editor. This represents what the editor will render when the block is used.
|
|
|
|
*
|
|
|
|
* @see https://developer.wordpress.org/block-editor/reference-guides/block-api/block-edit-save/#edit
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
export function Edit( { attributes }: { attributes: BlockAttributes } ) {
|
|
|
|
/**
|
|
|
|
* React hook that is used to mark the block wrapper element.
|
|
|
|
* It provides all the necessary props like the class name.
|
|
|
|
*
|
|
|
|
* @see https://developer.wordpress.org/block-editor/reference-guides/packages/packages-block-editor/#useblockprops
|
|
|
|
*/
|
2023-12-07 19:12:18 +00:00
|
|
|
const blockProps = useWooBlockProps(attributes);
|
2023-05-26 12:16:57 +00:00
|
|
|
return <div { ...blockProps }>{ attributes.message }</div>;
|
|
|
|
}
|