@@ -197,128 +197,122 @@ const searchBoxStyles = t => css`
197
197
/* stylelint-enable */
198
198
199
199
// Search shows a list of "hits", and is a child of the PluginSearchBar component
200
- class Search extends Component {
201
- render ( ) {
202
- return (
203
- < div sx = { { pb : [ 11 , null , null , 0 ] } } >
200
+ function Search ( { pathname, query } ) {
201
+ return (
202
+ < div sx = { { pb : [ 11 , null , null , 0 ] } } >
203
+ < div
204
+ sx = { {
205
+ borderBottomWidth : `1px` ,
206
+ borderBottomStyle : `solid` ,
207
+ borderColor : `ui.border` ,
208
+ display : `flex` ,
209
+ flexDirection : `column` ,
210
+ width : `100%` ,
211
+ } }
212
+ >
213
+ < Global styles = { searchBoxStyles } />
214
+ < SearchBox translations = { { placeholder : `Search Gatsby Library` } } />
215
+ < div css = { { display : `none` } } >
216
+ < Configure analyticsTags = { [ `gatsby-plugins` ] } />
217
+ < RefinementList
218
+ attribute = "keywords"
219
+ transformItems = { items =>
220
+ items . map ( ( { count, ...item } ) => {
221
+ return {
222
+ ...item ,
223
+ count : count || 0 ,
224
+ }
225
+ } )
226
+ }
227
+ defaultRefinement = { [ `gatsby-component` , `gatsby-plugin` ] }
228
+ />
229
+ < ToggleRefinement
230
+ attribute = "deprecated"
231
+ value = { false }
232
+ label = "No deprecated plugins"
233
+ defaultRefinement = { true }
234
+ />
235
+ </ div >
236
+
204
237
< div
205
238
sx = { {
206
- borderBottomWidth : `1px` ,
207
- borderBottomStyle : `solid` ,
208
- borderColor : `ui.border` ,
239
+ alignItems : `center` ,
240
+ color : `textMuted` ,
209
241
display : `flex` ,
210
- flexDirection : `column` ,
211
- width : `100%` ,
242
+ height : searchMetaHeight ,
243
+ px : 6 ,
244
+ fontSize : 0 ,
212
245
} }
213
246
>
214
- < Global styles = { searchBoxStyles } />
215
- < SearchBox translations = { { placeholder : `Search Gatsby Library` } } />
216
- < div css = { { display : `none` } } >
217
- < Configure analyticsTags = { [ `gatsby-plugins` ] } />
218
- < RefinementList
219
- attribute = "keywords"
220
- transformItems = { items =>
221
- items . map ( ( { count, ...item } ) => {
222
- return {
223
- ...item ,
224
- count : count || 0 ,
225
- }
226
- } )
227
- }
228
- defaultRefinement = { [ `gatsby-component` , `gatsby-plugin` ] }
229
- />
230
- < ToggleRefinement
231
- attribute = "deprecated"
232
- value = { false }
233
- label = "No deprecated plugins"
234
- defaultRefinement = { true }
235
- />
236
- </ div >
237
-
238
- < div
239
- sx = { {
240
- alignItems : `center` ,
241
- color : `textMuted` ,
242
- display : `flex` ,
243
- height : searchMetaHeight ,
244
- px : 6 ,
245
- fontSize : 0 ,
246
- } }
247
- >
248
- < Stats
249
- translations = { {
250
- stats : function ( n ) {
251
- return `${ n } results`
252
- } ,
253
- } }
254
- />
255
- < SkipNavLink />
256
- </ div >
257
- </ div >
258
-
259
- < div >
260
- < div
261
- sx = { {
262
- [ mediaQueries . md ] : {
263
- height : t =>
264
- `calc(100vh - ${ t . sizes . headerHeight } - ${ t . sizes . bannerHeight } - ${ searchInputHeight } - ${ searchInputWrapperMargin } - ${ searchMetaHeight } )` ,
265
- overflowY : `scroll` ,
247
+ < Stats
248
+ translations = { {
249
+ stats : function ( n ) {
250
+ return `${ n } results`
266
251
} ,
267
252
} }
268
- >
269
- < InfiniteHits
270
- hitComponent = { result => (
271
- < Result
272
- hit = { result . hit }
273
- pathname = { this . props . pathname }
274
- query = { this . props . query }
275
- />
276
- ) }
277
- />
278
- </ div >
253
+ />
254
+ < SkipNavLink />
279
255
</ div >
256
+ </ div >
280
257
258
+ < div >
281
259
< div
282
260
sx = { {
283
- fontSize : 0 ,
284
- lineHeight : 0 ,
285
- height : 20 ,
286
- mt : 6 ,
287
- display : `none` ,
261
+ [ mediaQueries . md ] : {
262
+ height : t =>
263
+ `calc(100vh - ${ t . sizes . headerHeight } - ${ t . sizes . bannerHeight } - ${ searchInputHeight } - ${ searchInputWrapperMargin } - ${ searchMetaHeight } )` ,
264
+ overflowY : `scroll` ,
265
+ } ,
288
266
} }
289
267
>
290
- < a
291
- href = { `https://www.algolia.com/` }
292
- sx = { {
293
- "&&" : {
268
+ < InfiniteHits
269
+ hitComponent = { result => (
270
+ < Result hit = { result . hit } pathname = { pathname } query = { query } />
271
+ ) }
272
+ />
273
+ </ div >
274
+ </ div >
275
+
276
+ < div
277
+ sx = { {
278
+ fontSize : 0 ,
279
+ lineHeight : 0 ,
280
+ height : 20 ,
281
+ mt : 6 ,
282
+ display : `none` ,
283
+ } }
284
+ >
285
+ < a
286
+ href = { `https://www.algolia.com/` }
287
+ sx = { {
288
+ "&&" : {
289
+ background : `url(${ AlgoliaLogo } )` ,
290
+ border : `none` ,
291
+ fontWeight : `body` ,
292
+ backgroundRepeat : `no-repeat` ,
293
+ backgroundPosition : `50%` ,
294
+ backgroundSize : `100%` ,
295
+ overflow : `hidden` ,
296
+ textIndent : `-9000px` ,
297
+ padding : `0!important` ,
298
+ width : 110 ,
299
+ height : `100%` ,
300
+ display : `block` ,
301
+ ml : `auto` ,
302
+ "&:hover" : {
294
303
background : `url(${ AlgoliaLogo } )` ,
295
- border : `none` ,
296
- fontWeight : `body` ,
297
304
backgroundRepeat : `no-repeat` ,
298
305
backgroundPosition : `50%` ,
299
306
backgroundSize : `100%` ,
300
- overflow : `hidden` ,
301
- textIndent : `-9000px` ,
302
- padding : `0!important` ,
303
- width : 110 ,
304
- height : `100%` ,
305
- display : `block` ,
306
- ml : `auto` ,
307
- "&:hover" : {
308
- background : `url(${ AlgoliaLogo } )` ,
309
- backgroundRepeat : `no-repeat` ,
310
- backgroundPosition : `50%` ,
311
- backgroundSize : `100%` ,
312
- } ,
313
307
} ,
314
- } }
315
- >
316
- Algolia
317
- </ a >
318
- </ div >
308
+ } ,
309
+ } }
310
+ >
311
+ Algolia
312
+ </ a >
319
313
</ div >
320
- )
321
- }
314
+ </ div >
315
+ )
322
316
}
323
317
324
318
// the result component is fed into the InfiniteHits component
0 commit comments