PluginProbe
WebberZone Top 10 — Popular Posts / 4.5.1
WebberZone Top 10 — Popular Posts v4.5.1
4.5.1 4.5.0 4.4.3 4.4.2 4.4.1 4.4.0 4.3.4 4.3.3 4.3.2 4.3.1 4.3.0 trunk 1.0 1.0.1 1.1 1.2 1.3 1.4 1.4.1 1.5 1.5.1 1.5.2 1.5.3 1.6 1.6.1 All 117 releases
← All changes | includes/frontend/blocks/src/popular-posts/edit.js +45 -45 4.3.2 → 4.5.1 View file →
@@ -8,27 +8,27 @@
8 8 import { PostDisplayControls } from './components/post-display-controls';
9 9 import { StyleControls } from './components/style-controls';
10 10 import { OtherAttributesControl } from './components/other-attributes-control';
11 11
12 -export default function Edit({ attributes, setAttributes }) {
12 +export default function Edit( { attributes, setAttributes } ) {
13 13 const {
14 14 heading,
15 15 daily,
16 - show_excerpt,
17 - show_author,
18 - show_date,
19 - disp_list_count,
20 - other_attributes,
16 + show_excerpt: showExcerpt,
17 + show_author: showAuthor,
18 + show_date: showDate,
19 + disp_list_count: displayListCount,
20 + other_attributes: otherAttributes,
21 21 } = attributes;
22 22
23 23 const blockProps = useBlockProps();
24 24
25 - const handleToggle = (attributeName) => () => {
26 - setAttributes({ [attributeName]: !attributes[attributeName] });
25 + const handleToggle = ( attributeName ) => () => {
26 + setAttributes( { [ attributeName ]: ! attributes[ attributeName ] } );
27 27 };
28 28
29 - const handleChange = (attributeName) => (newValue) => {
30 - setAttributes({ [attributeName]: newValue });
29 + const handleChange = ( attributeName ) => ( newValue ) => {
30 + setAttributes( { [ attributeName ]: newValue } );
31 31 };
32 32
33 33 return (
34 34 <>
@@ -33,87 +33,87 @@
33 33 return (
34 34 <>
35 35 <InspectorControls>
36 36 <PanelBody
37 - title={__('Popular Posts Settings', 'top-10')}
38 - initialOpen={true}
37 + title={ __( 'Popular Posts Settings', 'top-10' ) }
38 + initialOpen={ true }
39 39 >
40 40 <ToggleControlGroup
41 - controls={[
41 + controls={ [
42 42 {
43 - label: __('Custom period?', 'top-10'),
43 + label: __( 'Custom period?', 'top-10' ),
44 44 attributeName: 'daily',
45 45 checked: daily,
46 - onChange: handleToggle('daily'),
46 + onChange: handleToggle( 'daily' ),
47 47 },
48 - ]}
48 + ] }
49 49 />
50 50
51 - {daily && (
51 + { daily && (
52 52 <RangeControls
53 - attributes={attributes}
54 - onChange={handleChange}
53 + attributes={ attributes }
54 + onChange={ handleChange }
55 55 />
56 - )}
56 + ) }
57 57
58 58 <PostDisplayControls
59 - attributes={attributes}
60 - onChange={handleChange}
59 + attributes={ attributes }
60 + onChange={ handleChange }
61 61 />
62 62
63 63 <ToggleControlGroup
64 - controls={[
64 + controls={ [
65 65 {
66 - label: __('Show heading', 'top-10'),
66 + label: __( 'Show heading', 'top-10' ),
67 67 attributeName: 'heading',
68 68 checked: heading,
69 - onChange: handleToggle('heading'),
69 + onChange: handleToggle( 'heading' ),
70 70 },
71 71 {
72 - label: __('Show excerpt', 'top-10'),
72 + label: __( 'Show excerpt', 'top-10' ),
73 73 attributeName: 'show_excerpt',
74 - checked: show_excerpt,
75 - onChange: handleToggle('show_excerpt'),
74 + checked: showExcerpt,
75 + onChange: handleToggle( 'show_excerpt' ),
76 76 },
77 77 {
78 - label: __('Show author', 'top-10'),
78 + label: __( 'Show author', 'top-10' ),
79 79 attributeName: 'show_author',
80 - checked: show_author,
81 - onChange: handleToggle('show_author'),
80 + checked: showAuthor,
81 + onChange: handleToggle( 'show_author' ),
82 82 },
83 83 {
84 - label: __('Show date', 'top-10'),
84 + label: __( 'Show date', 'top-10' ),
85 85 attributeName: 'show_date',
86 - checked: show_date,
87 - onChange: handleToggle('show_date'),
86 + checked: showDate,
87 + onChange: handleToggle( 'show_date' ),
88 88 },
89 89 {
90 - label: __('Show count', 'top-10'),
90 + label: __( 'Show count', 'top-10' ),
91 91 attributeName: 'disp_list_count',
92 - checked: disp_list_count,
93 - onChange: handleToggle('disp_list_count'),
92 + checked: displayListCount,
93 + onChange: handleToggle( 'disp_list_count' ),
94 94 },
95 - ]}
95 + ] }
96 96 />
97 97
98 98 <StyleControls
99 - attributes={attributes}
100 - onChange={handleChange}
99 + attributes={ attributes }
100 + onChange={ handleChange }
101 101 />
102 102
103 103 <OtherAttributesControl
104 - value={other_attributes}
105 - onChange={handleChange('other_attributes')}
104 + value={ otherAttributes }
105 + onChange={ handleChange( 'other_attributes' ) }
106 106 />
107 107 </PanelBody>
108 108 </InspectorControls>
109 109
110 - <div {...blockProps}>
110 + <div { ...blockProps }>
111 111 <Disabled>
112 112 <ServerSideRender
113 113 block="top-10/popular-posts"
114 - attributes={attributes}
115 - urlQueryArgs={{ _locale: 'site' }}
114 + attributes={ attributes }
115 + urlQueryArgs={ { _locale: 'site' } }
116 116 />
117 117 </Disabled>
118 118 </div>
119 119 </>