1
1
import React , { useEffect } from 'react' ;
2
- import TextField from '@material-ui/core/TextField'
3
- import InputAdornment from '@material-ui/core/InputAdornment'
2
+ import TextField from '@material-ui/core/TextField' ;
3
+ import InputAdornment from '@material-ui/core/InputAdornment' ;
4
4
import makeStyles from '@material-ui/core/styles/makeStyles' ;
5
5
import Search from '@material-ui/icons/Search' ;
6
6
7
7
const useStyles = makeStyles ( ( ) => ( {
8
8
docSearchWrapper : {
9
9
marginRight : 16 ,
10
10
'& .algolia-docsearch-suggestion.algolia-docsearch-suggestion__main.algolia-docsearch-suggestion__secondary' : {
11
- textDecoration : 'none'
11
+ textDecoration : 'none' ,
12
12
} ,
13
13
'& .algolia-autocomplete .algolia-docsearch-suggestion--title' : {
14
- marginBottom : 0
14
+ marginBottom : 0 ,
15
15
} ,
16
16
'& .ds-dropdown-menu' : {
17
17
'& [class^=ds-dataset-]' : {
18
18
borderRadius : 0 ,
19
19
} ,
20
20
'&:before' : {
21
- display : 'none'
22
- }
21
+ display : 'none' ,
22
+ } ,
23
23
} ,
24
24
} ,
25
25
docSearchInput : {
26
26
'& input' : {
27
- color : 'white'
27
+ color : 'white' ,
28
28
} ,
29
29
'& .MuiInput-underline:hover:not(.Mui-disabled):before' : {
30
30
borderBottomColor : 'white' ,
@@ -37,19 +37,21 @@ const useStyles = makeStyles(() => ({
37
37
} ,
38
38
} ,
39
39
docSearchIcon : {
40
- fill : 'white'
41
- }
40
+ fill : 'white' ,
41
+ } ,
42
42
} ) ) ;
43
43
44
44
const DocSearch = ( ) => {
45
- const classes = useStyles ( )
45
+ const classes = useStyles ( ) ;
46
46
useEffect ( ( ) => {
47
- window . docsearch ( {
48
- apiKey : '5e9dbd314423e38339595e183d1ae7b6' ,
49
- indexName : 'data-driven-forms' ,
50
- inputSelector : '#data-driven-forms-search' ,
51
- debug : false
52
- } ) ;
47
+ if ( window . docsearch ) {
48
+ window . docsearch ( {
49
+ apiKey : '5e9dbd314423e38339595e183d1ae7b6' ,
50
+ indexName : 'data-driven-forms' ,
51
+ inputSelector : '#data-driven-forms-search' ,
52
+ debug : false ,
53
+ } ) ;
54
+ }
53
55
} , [ ] ) ;
54
56
return (
55
57
< form className = { classes . docSearchWrapper } >
0 commit comments