@@ -3,46 +3,47 @@ import {
33 ALGOLIA_APPLICATION_ID ,
44 ALGOLIA_DEFAULT_INDEX ,
55} from '@codesandbox/common/lib/utils/config' ;
6- import { Helmet } from 'react-helmet' ;
76import MaxWidth from '@codesandbox/common/lib/components/flex/MaxWidth' ;
87import Margin from '@codesandbox/common/lib/components/spacing/Margin' ;
8+ import { RouteComponentProps } from 'react-router-dom' ;
99import qs from 'qs' ;
10- import React , { useCallback , useEffect , useRef , useState } from 'react' ;
10+ import React , {
11+ FunctionComponent ,
12+ useCallback ,
13+ useEffect ,
14+ useRef ,
15+ useState ,
16+ } from 'react' ;
17+ import { Helmet } from 'react-helmet' ;
1118import {
19+ Configure ,
1220 InstantSearch ,
13- SearchBox ,
1421 PoweredBy ,
15- Configure ,
22+ SearchBox ,
1623} from 'react-instantsearch/dom' ;
17- import { History , Location } from 'history' ;
1824
19- import { Navigation } from 'app/pages/common/Navigation' ;
2025import { useOvermind } from 'app/overmind' ;
26+ import { Navigation } from 'app/pages/common/Navigation' ;
2127
2228import 'instantsearch.css/themes/reset.css' ;
2329
24- import { Container , Content , Main , StyledTitle } from './elements' ;
30+ import { Container , Content , Main , Title } from './elements' ;
2531import Filters from './Filters' ;
2632import Results from './Results' ;
2733import Styles from './search' ;
2834
29- interface ISearchProps {
30- history : History ;
31- location : Location ;
32- }
33-
3435const updateAfter = 700 ;
3536
3637const createURL = state => `?${ qs . stringify ( state ) } ` ;
3738
3839const searchStateToUrl = ( location , searchState ) =>
3940 searchState ? `${ location . pathname } ${ createURL ( searchState ) } ` : '' ;
4041
41- const Search : React . FC < ISearchProps > = ( { history, location } ) => {
42+ type Props = RouteComponentProps ;
43+ export const Search : FunctionComponent < Props > = ( { history, location } ) => {
4244 const {
4345 actions : { searchMounted } ,
4446 } = useOvermind ( ) ;
45-
4647 const [ searchState , setSearchState ] = useState (
4748 qs . parse ( location . search . slice ( 1 ) )
4849 ) ;
@@ -83,6 +84,7 @@ const Search: React.FC<ISearchProps> = ({ history, location }) => {
8384 < Helmet >
8485 < title > Search - CodeSandbox</ title >
8586 </ Helmet >
87+
8688 < Styles />
8789
8890 < MaxWidth >
@@ -91,8 +93,8 @@ const Search: React.FC<ISearchProps> = ({ history, location }) => {
9193
9294 < Content >
9395 < InstantSearch
94- appId = { ALGOLIA_APPLICATION_ID }
9596 apiKey = { ALGOLIA_API_KEY }
97+ appId = { ALGOLIA_APPLICATION_ID }
9698 createURL = { createURL }
9799 indexName = { ALGOLIA_DEFAULT_INDEX }
98100 onSearchStateChange = { onSearchStateChange }
@@ -102,7 +104,7 @@ const Search: React.FC<ISearchProps> = ({ history, location }) => {
102104
103105 < Main alignItems = "flex-start" >
104106 < div >
105- < StyledTitle > Search</ StyledTitle >
107+ < Title > Search</ Title >
106108
107109 < PoweredBy />
108110
@@ -123,6 +125,3 @@ const Search: React.FC<ISearchProps> = ({ history, location }) => {
123125 </ Container >
124126 ) ;
125127} ;
126-
127- // eslint-disable-next-line import/no-default-export
128- export default Search ;
0 commit comments