File tree Expand file tree Collapse file tree 6 files changed +355
-359
lines changed Expand file tree Collapse file tree 6 files changed +355
-359
lines changed Original file line number Diff line number Diff line change 13
13
< body >
14
14
< div class ="container ">
15
15
< div class ="col-md-12 ">
16
- < div class ="docs-searchbar ">
17
- < div class ="searchbox ">
18
- < input
19
- type ="search "
20
- placeholder ="docs-searchbar input "
21
- class ="form-control "
22
- id ="q "
23
- />
24
- </ div >
25
- </ div >
16
+ < input
17
+ type ="search "
18
+ placeholder ="docs-searchbar input "
19
+ class ="form-control "
20
+ id ="q "
21
+ />
26
22
</ div >
27
23
</ div >
28
24
<!-- at the end of the BODY -->
43
39
console . info ( context )
44
40
} ,
45
41
debug : true , // Set debug to true if you want to inspect the dropdown
42
+ enhancedSearchInput : true ,
43
+ enableDarkMode : true ,
46
44
} )
47
45
</ script >
48
46
< style >
49
47
.container {
50
48
margin : 10% ;
51
49
}
52
50
53
- div [data-ds-theme ] . searchbox {
51
+ . searchbox [data-ds-theme ] {
54
52
width : 60% ;
55
53
margin : auto;
56
54
margin-top : 10% ;
57
55
display : block;
58
56
}
59
57
60
- div [data-ds-theme ] . searchbox input {
58
+ . searchbox [data-ds-theme ] input {
61
59
height : 34px ;
62
60
border-radius : 4px ;
63
61
font-size : 14px ;
64
- padding : 6px 12px ;
65
62
}
66
63
67
64
@media (prefers-color-scheme : dark) {
Original file line number Diff line number Diff line change 34
34
margin : 10% ;
35
35
}
36
36
37
- div [data-ds-theme ] . searchbox {
37
+ . searchbox [data-ds-theme ] {
38
38
width : 60% ;
39
39
margin : auto;
40
40
margin-top : 10% ;
41
41
display : block;
42
42
}
43
43
44
- div [data-ds-theme ] . searchbox input {
44
+ . searchbox [data-ds-theme ] input {
45
45
height : 34px ;
46
46
border-radius : 4px ;
47
47
font-size : 14px ;
48
- padding : 6px 12px ;
49
48
}
50
49
51
50
@media (prefers-color-scheme : dark) {
Original file line number Diff line number Diff line change @@ -97,18 +97,6 @@ class DocsSearchBar {
97
97
this . isSimpleLayout = layout === 'simple'
98
98
this . enableDarkMode = enableDarkMode
99
99
100
- const isSystemInDarkMode =
101
- window . matchMedia &&
102
- window . matchMedia ( '(prefers-color-scheme: dark)' ) . matches
103
- const searchbox = document . querySelector ( '.docs-searchbar' )
104
- if ( searchbox ) {
105
- if ( this . enableDarkMode && isSystemInDarkMode ) {
106
- searchbox . setAttribute ( 'data-ds-theme' , 'dark' )
107
- } else {
108
- searchbox . setAttribute ( 'data-ds-theme' , 'light' )
109
- }
110
- }
111
-
112
100
this . client = new MeiliSearch ( {
113
101
host : hostUrl ,
114
102
apiKey : this . apiKey ,
@@ -129,6 +117,18 @@ class DocsSearchBar {
129
117
} ,
130
118
] )
131
119
120
+ const isSystemInDarkMode =
121
+ window . matchMedia &&
122
+ window . matchMedia ( '(prefers-color-scheme: dark)' ) . matches
123
+ const searchbox = document . querySelector ( '.searchbox' )
124
+ console . log ( searchbox )
125
+ if ( searchbox ) {
126
+ searchbox . setAttribute ( 'data-ds-theme' , 'light' )
127
+ if ( this . enableDarkMode && isSystemInDarkMode ) {
128
+ searchbox . setAttribute ( 'data-ds-theme' , 'dark' )
129
+ }
130
+ }
131
+
132
132
const customHandleSelected = handleSelected
133
133
this . handleSelected = customHandleSelected || this . handleSelected
134
134
You can’t perform that action at this time.
0 commit comments