This repository has been archived by the owner on Feb 23, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 217
/
index.js
72 lines (66 loc) · 1.44 KB
/
index.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
/**
* External dependencies
*/
import { __ } from '@wordpress/i18n';
import { registerBlockType } from '@wordpress/blocks';
import { Icon, discussion } from '@woocommerce/icons';
/**
* Internal dependencies
*/
import '../editor.scss';
import Editor from './edit';
import sharedAttributes from '../attributes';
import save from '../save.js';
import getDeprecatedProperty from '../deprecated.js';
import { example } from '../example';
const attributes = {
...sharedAttributes,
/**
* Show the product name.
*/
showProductName: {
type: 'boolean',
default: true,
},
};
/**
* Register and run the "All Reviews" block.
* This block lists all product reviews.
*/
registerBlockType( 'woocommerce/all-reviews', {
title: __( 'All Reviews', 'woo-gutenberg-products-block' ),
icon: {
src: <Icon srcElement={ discussion } />,
foreground: '#96588a',
},
category: 'woocommerce',
keywords: [ __( 'WooCommerce', 'woo-gutenberg-products-block' ) ],
description: __(
'Show a list of all product reviews.',
'woo-gutenberg-products-block'
),
supports: {
html: false,
},
example: {
...example,
attributes: {
...example.attributes,
showProductName: true,
},
},
attributes,
/**
* Renders and manages the block.
*
* @param {Object} props Props to pass to block.
*/
edit( props ) {
return <Editor { ...props } />;
},
/**
* Save the props to post content.
*/
save,
deprecated: getDeprecatedProperty( attributes ),
} );