import { __ } from '@wordpress/i18n'; import { useBlockProps, PlainText } from '@wordpress/block-editor'; import type { BlockEditProps } from '@wordpress/blocks'; import type { QueryPaginationNextAttributes, QueryPaginationNextBlockContext, } from './types'; const arrowMap = { none: '', arrow: '→', chevron: '»', }; export default function QueryPaginationNextEdit( { attributes: { label }, setAttributes, context: { paginationArrow, showLabel }, }: BlockEditProps< QueryPaginationNextAttributes > & { context: QueryPaginationNextBlockContext; } ) { const displayArrow = arrowMap[ paginationArrow! ]; return ( event.preventDefault() } { ...useBlockProps() } > { showLabel && ( setAttributes( { label: newLabel } ) } /> ) } { displayArrow && ( <span className={ `wp-block-query-pagination-next-arrow is-arrow-${ paginationArrow }` } aria-hidden > { displayArrow } </span> ) } </a> ); }