62 lines
1.2 KiB
JavaScript
62 lines
1.2 KiB
JavaScript
/**
|
|
* External dependencies
|
|
*/
|
|
import { __ } from '@wordpress/i18n';
|
|
import { registerBlockType } from '@wordpress/blocks';
|
|
import { IconAllReviews } from '@woocommerce/block-components/icons';
|
|
|
|
/**
|
|
* Internal dependencies
|
|
*/
|
|
import '../editor.scss';
|
|
import Editor from './edit';
|
|
import sharedAttributes from '../attributes';
|
|
import save from '../save.js';
|
|
import { example } from '../example';
|
|
|
|
/**
|
|
* Register and run the "All Reviews" block.
|
|
*/
|
|
registerBlockType( 'woocommerce/all-reviews', {
|
|
title: __( 'All Reviews', 'woo-gutenberg-products-block' ),
|
|
icon: {
|
|
src: <IconAllReviews />,
|
|
foreground: '#96588a',
|
|
},
|
|
category: 'woocommerce',
|
|
keywords: [ __( 'WooCommerce', 'woo-gutenberg-products-block' ) ],
|
|
description: __(
|
|
'Shows a list of all product reviews.',
|
|
'woo-gutenberg-products-block'
|
|
),
|
|
example: {
|
|
...example,
|
|
attributes: {
|
|
...example.attributes,
|
|
showProductName: true,
|
|
},
|
|
},
|
|
attributes: {
|
|
...sharedAttributes,
|
|
/**
|
|
* Show the product name.
|
|
*/
|
|
showProductName: {
|
|
type: 'boolean',
|
|
default: true,
|
|
},
|
|
},
|
|
|
|
/**
|
|
* Renders and manages the block.
|
|
*/
|
|
edit( props ) {
|
|
return <Editor { ...props } />;
|
|
},
|
|
|
|
/**
|
|
* Save the props to post content.
|
|
*/
|
|
save,
|
|
} );
|