/** * External dependencies */ import { __ } from '@wordpress/i18n'; import { Disabled, Placeholder } from '@wordpress/components'; import ServerSideRender from '@wordpress/server-side-render'; import { gridBlockPreview } from '@woocommerce/resource-previews'; import { Icon, percent } from '@wordpress/icons'; import { useBlockProps } from '@wordpress/block-editor'; /** * Internal dependencies */ import { Attributes } from './types'; import { ProductOnSaleInspectorControls } from './inspector-controls'; interface Props { attributes: Attributes; setAttributes: ( attributes: Record< string, unknown > ) => void; name: string; } const EmptyPlaceholder = () => ( } label={ __( 'On Sale Products', 'woocommerce' ) } className="wc-block-product-on-sale" > { __( 'This block shows on-sale products. There are currently no discounted products in your store.', 'woocommerce' ) } ); /** * Component to handle edit mode of "On Sale Products". */ const ProductOnSaleBlock: React.FunctionComponent< Props > = ( props: Props ) => { const { attributes, setAttributes, name } = props; const blockProps = useBlockProps(); if ( attributes.isPreview ) { return
{ gridBlockPreview }
; } return (
); }; export default ProductOnSaleBlock;