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
69 lines (64 loc) · 1.41 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
/**
* External dependencies
*/
import { __ } from '@wordpress/i18n';
import { registerBlockType } from '@wordpress/blocks';
import { Icon, comment } 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,
/**
* The id of the product to load reviews for.
*/
productId: {
type: 'number',
},
};
/**
* Register and run the "Reviews by Product" block.
*/
registerBlockType( 'woocommerce/reviews-by-product', {
title: __( 'Reviews by Product', 'woo-gutenberg-products-block' ),
icon: {
src: <Icon srcElement={ comment } />,
foreground: '#96588a',
},
category: 'woocommerce',
keywords: [ __( 'WooCommerce', 'woo-gutenberg-products-block' ) ],
description: __(
'Show reviews of your products to build trust.',
'woo-gutenberg-products-block'
),
supports: {
html: false,
},
example: {
...example,
attributes: {
...example.attributes,
productId: 1,
},
},
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 ),
} );