PluginProbe
ElasticPress / 4.4.0
ElasticPress v4.4.0
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 / instant-results / components / layout.js

layout.js in ElasticPress 4.4.0, at assets/js/instant-results/components/layout.js

63 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 { useContext, WPElement } from '@wordpress/element';
5
6 /**
7 * Internal dependencies.
8 */
9 import { facets } from '../config';
10 import Context from '../context';
11 import Facet from './facets/facet';
12 import SearchTermFacet from './facets/search-term-facet';
13 import Results from './layout/results';
14 import Sidebar from './layout/sidebar';
15 import Toolbar from './layout/toolbar';
16 import ActiveConstraints from './tools/active-constraints';
17 import ClearConstraints from './tools/clear-constraints';
18 import SidebarToggle from './tools/sidebar-toggle';
19 import Sort from './tools/sort';
20
21 /**
22 * Search dialog.
23 *
24 * @returns {WPElement} Component element.
25 */
26 export default () => {
27 const {
28 state: { isLoading },
29 } = useContext(Context);
30
31 return (
32 <div className={`ep-search-page ${isLoading ? 'is-loading' : ''}`}>
33 <div className="ep-search-page__header">
34 <SearchTermFacet />
35
36 <Toolbar>
37 <ActiveConstraints />
38 <ClearConstraints />
39 <SidebarToggle />
40 </Toolbar>
41 </div>
42
43 <div className="ep-search-page__body">
44 <Sidebar>
45 <Sort />
46 {facets.map(({ label, name, postTypes, type }, index) => (
47 <Facet
48 index={index}
49 key={name}
50 label={label}
51 name={name}
52 postTypes={postTypes}
53 type={type}
54 />
55 ))}
56 </Sidebar>
57
58 <Results />
59 </div>
60 </div>
61 );
62 };
63