|
7 | 7 | */ |
8 | 8 |
|
9 | 9 | import _truncate from "lodash/truncate"; |
| 10 | +import { Component } from "react"; |
10 | 11 | import PropTypes from "prop-types"; |
11 | | -import React, { Component } from "react"; |
12 | 12 | import { OverridableContext } from "react-overridable"; |
13 | 13 | import { |
14 | 14 | Button, |
@@ -142,65 +142,63 @@ const overriddenComponents = { |
142 | 142 | "ResultsGrid.item.opensearch": OpenSearchResultsGridItem, |
143 | 143 | }; |
144 | 144 |
|
145 | | -export class App extends Component { |
146 | | - render() { |
147 | | - return ( |
148 | | - <OverridableContext.Provider value={overriddenComponents}> |
149 | | - <ReactSearchKit searchApi={searchApi} initialQueryState={initialState}> |
150 | | - <Container> |
151 | | - <Grid> |
152 | | - <Grid.Row> |
153 | | - <Grid.Column width={3} /> |
154 | | - <Grid.Column width={10}> |
155 | | - <SearchBar /> |
156 | | - </Grid.Column> |
157 | | - <Grid.Column width={3} /> |
158 | | - </Grid.Row> |
159 | | - </Grid> |
160 | | - <Grid relaxed style={{ padding: "2em 0" }}> |
161 | | - <Grid.Row columns={2}> |
162 | | - <Grid.Column width={4}> |
163 | | - <RangeFacet |
164 | | - title="Year" |
165 | | - agg={{ aggName: "years" }} |
166 | | - rangeSeparator=".." |
167 | | - defaultRanges={[ |
168 | | - { label: "Last 1 year", type: "years", value: 1 }, |
169 | | - { label: "Last 5 years", type: "years", value: 5 }, |
170 | | - { label: "Last 6 months", type: "months", value: 6 }, |
171 | | - ]} |
172 | | - enableCustomRange |
173 | | - /> |
174 | | - <BucketAggregation |
175 | | - title="Tags" |
176 | | - agg={{ field: "tags", aggName: "tags_agg" }} |
177 | | - renderValuesContainerElement={customAggValuesContainerCmp} |
178 | | - renderValueElement={customAggValueCmp} |
179 | | - /> |
180 | | - <BucketAggregation |
181 | | - title="Employee Types" |
182 | | - agg={{ |
183 | | - field: "employee_type.type", |
184 | | - aggName: "type_agg", |
185 | | - childAgg: { |
186 | | - field: "employee_type.subtype", |
187 | | - aggName: "subtype_agg", |
188 | | - }, |
189 | | - }} |
190 | | - /> |
191 | | - </Grid.Column> |
192 | | - <Grid.Column width={12}> |
193 | | - <ResultsLoader> |
194 | | - <EmptyResults /> |
195 | | - <Error /> |
196 | | - <OnResults /> |
197 | | - </ResultsLoader> |
198 | | - </Grid.Column> |
199 | | - </Grid.Row> |
200 | | - </Grid> |
201 | | - </Container> |
202 | | - </ReactSearchKit> |
203 | | - </OverridableContext.Provider> |
204 | | - ); |
205 | | - } |
| 145 | +export function App() { |
| 146 | + return ( |
| 147 | + <OverridableContext.Provider value={overriddenComponents}> |
| 148 | + <ReactSearchKit searchApi={searchApi} initialQueryState={initialState}> |
| 149 | + <Container> |
| 150 | + <Grid> |
| 151 | + <Grid.Row> |
| 152 | + <Grid.Column width={3} /> |
| 153 | + <Grid.Column width={10}> |
| 154 | + <SearchBar /> |
| 155 | + </Grid.Column> |
| 156 | + <Grid.Column width={3} /> |
| 157 | + </Grid.Row> |
| 158 | + </Grid> |
| 159 | + <Grid relaxed style={{ padding: "2em 0" }}> |
| 160 | + <Grid.Row columns={2}> |
| 161 | + <Grid.Column width={4}> |
| 162 | + <RangeFacet |
| 163 | + title="Year" |
| 164 | + agg={{ aggName: "years" }} |
| 165 | + rangeSeparator=".." |
| 166 | + defaultRanges={[ |
| 167 | + { label: "Last 1 year", type: "years", value: 1 }, |
| 168 | + { label: "Last 5 years", type: "years", value: 5 }, |
| 169 | + { label: "Last 6 months", type: "months", value: 6 }, |
| 170 | + ]} |
| 171 | + enableCustomRange |
| 172 | + /> |
| 173 | + <BucketAggregation |
| 174 | + title="Tags" |
| 175 | + agg={{ field: "tags", aggName: "tags_agg" }} |
| 176 | + renderValuesContainerElement={customAggValuesContainerCmp} |
| 177 | + renderValueElement={customAggValueCmp} |
| 178 | + /> |
| 179 | + <BucketAggregation |
| 180 | + title="Employee Types" |
| 181 | + agg={{ |
| 182 | + field: "employee_type.type", |
| 183 | + aggName: "type_agg", |
| 184 | + childAgg: { |
| 185 | + field: "employee_type.subtype", |
| 186 | + aggName: "subtype_agg", |
| 187 | + }, |
| 188 | + }} |
| 189 | + /> |
| 190 | + </Grid.Column> |
| 191 | + <Grid.Column width={12}> |
| 192 | + <ResultsLoader> |
| 193 | + <EmptyResults /> |
| 194 | + <Error /> |
| 195 | + <OnResults /> |
| 196 | + </ResultsLoader> |
| 197 | + </Grid.Column> |
| 198 | + </Grid.Row> |
| 199 | + </Grid> |
| 200 | + </Container> |
| 201 | + </ReactSearchKit> |
| 202 | + </OverridableContext.Provider> |
| 203 | + ); |
206 | 204 | } |
0 commit comments