PluginProbe
ElasticPress / 5.0.1
ElasticPress v5.0.1
5.3.5 5.3.4 3.6.5 3.6.6 4.0.0 4.0.1 4.1.0 4.2.0 4.2.1 4.2.2 4.3.0 4.3.1 4.4.0 4.4.1 4.5.0 4.5.1 4.5.2 4.6.0 4.6.1 4.7.0 4.7.1 4.7.2 5.0.0 5.0.1 5.0.2 All 108 releases
elasticpress / assets / js / blocks / facets / date / edit.js

edit.js in ElasticPress 5.0.1, at assets/js/blocks/facets/date/edit.js

51 lines 1.4 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 /**
2 * WordPress dependencies.
3 */
4 import { InspectorControls, useBlockProps } from '@wordpress/block-editor';
5 import { Disabled, PanelBody, ToggleControl } from '@wordpress/components';
6 import { __ } from '@wordpress/i18n';
7 import ServerSideRender from '@wordpress/server-side-render';
8
9 /**
10 * Internal dependencies.
11 */
12 import EmptyResponsePlaceholder from '../common/components/empty-response-placeholder';
13 import LoadingResponsePlaceholder from '../common/components/loading-response-placeholder';
14
15 const FacetDate = (props) => {
16 const blockProps = useBlockProps();
17 const { attributes, name, setAttributes } = props;
18 const { displayCustomDate } = attributes;
19
20 return (
21 <>
22 <InspectorControls>
23 <PanelBody title={__('Settings', 'elasticpress')}>
24 <ToggleControl
25 label={__('Display custom date option', 'elasticpress')}
26 checked={displayCustomDate}
27 onChange={(displayCustomDate) => setAttributes({ displayCustomDate })}
28 />
29 </PanelBody>
30 </InspectorControls>
31
32 <div {...blockProps}>
33 <Disabled>
34 <ServerSideRender
35 attributes={{
36 ...attributes,
37 isPreview: true,
38 }}
39 block={name}
40 EmptyResponsePlaceholder={EmptyResponsePlaceholder}
41 LoadingResponsePlaceholder={LoadingResponsePlaceholder}
42 skipBlockSupportAttributes
43 />
44 </Disabled>
45 </div>
46 </>
47 );
48 };
49
50 export default FacetDate;
51