2020 width : 100% ;
2121 height : 200vh ;
2222 background-color : rgba (0 , 0 , 0 , 0.35 );
23- z-index : 1000 ;
23+ z-index : 11000 ;
2424 }
2525
2626 .algolia-search {
27- z-index : 5000 ;
27+ & .isfocused {
28+ z-index : 12000 ;
29+ }
2830 position : relative;
2931 .search-panel {
3032 display : block;
3436 flex : 3 ;
3537 }
3638
37- .ais-Highlight-highlighted {
38- color : inherit;
39- font-size : inherit;
40- }
41-
4239 # searchbox {
4340 margin-bottom : 2rem ;
4441 }
5956 margin-top : 10px ;
6057 margin-bottom : 10px ;
6158 }
62-
6359 .search-result-image {
6460 height : auto;
61+ width : auto;
62+ @media (min-width : 992px ) {
63+ position : absolute;
64+ }
65+ top : 0 ;
66+ left : 0 ;
67+ bottom : 0 ;
68+ right : 0 ;
6569 max-height : 175px ;
6670 max-width : 100% ;
6771 margin : auto;
7579 list-style : none;
7680 }
7781
78- .ais-Highlight-highlighted ,
79- .ais-Snippet-highlighted {
82+ mark {
8083 background-color : # FFFF92 ;
8184 }
8285 }
8386</ style >
8487<!-- Search -->
8588< div class ="search-overlay d-none "> </ div >
86- < section class ="section color-blue ">
89+ < section class ="section color-blue " id =" search " >
8790 < div class ="container algolia-search rounded-lg ">
8891 < div class ="row ">
8992 < div class ="col ">
90- < h2 class ="pt-5 color-blue "> Search </ h2 >
93+ < h2 class ="pt-5 color-blue "> {{i18n "search" }} </ h2 >
9194 </ div >
9295 </ div >
9396 < div class ="row ">
@@ -165,6 +168,11 @@ <h2 class="pt-5 color-blue">Search</h2>
165168 return ;
166169 }
167170
171+ if ( ! items || ! items . length > 0 ) {
172+ container . querySelector ( 'ol' ) . innerHTML = `<p>{{i18n "search-no-results"}}</p>` ;
173+ return ;
174+ }
175+
168176 container . querySelector ( 'ol' ) . innerHTML = items
169177 . map (
170178 item => {
@@ -173,13 +181,13 @@ <h2 class="pt-5 color-blue">Search</h2>
173181 <a href=${ item . url } class="container">
174182 <div class="row search-result-row">
175183 <div class="col-12 col-lg-2">
176- <div class="my-3">
177- <img class="image-fluid search-result-image d-flex " src=${ item . image } alt=${ item . title } />
184+ <div class="my-3 text-center image-frame ">
185+ <img class="image-fluid search-result-image d-inline p-2 " src=${ item . image } alt=${ item . title } />
178186 </div>
179187 </div>
180188 <div class="col-12 col-lg-10">
181- <h3 class="color-blue search-result-title">${ item . title } </h3>
182- <p class="color-gray search-result-subtitle">${ item . subtitle } </p>
189+ <h3 class="color-blue search-result-title">${ item . _highlightResult . title . value } </h3>
190+ <p class="color-gray search-result-subtitle">${ item . _highlightResult . subtitle . value } </p>
183191 </div>
184192 </div>
185193 </a>
@@ -195,7 +203,7 @@ <h3 class="color-blue search-result-title">${item.title}</h3>
195203 placeholder : '{{ i18n "search-type-to-start" }}' ,
196204 } ) ,
197205 instantsearch . widgets . configure ( {
198- hitsPerPage : 3 ,
206+ hitsPerPage : 8 ,
199207 filters : "language:{{$.Site.Language.Lang}}"
200208 } ) ,
201209 infiniteHits ( {
@@ -211,6 +219,7 @@ <h3 class="color-blue search-result-title">${item.title}</h3>
211219 docReady ( function ( ) {
212220 $ ( "input.ais-SearchBox-input" ) . on ( "focus" , function ( ) {
213221 $ ( ".algolia-search" ) . addClass ( "bg-lightblue" ) ;
222+ $ ( ".algolia-search" ) . addClass ( "isfocused" ) ;
214223 $ ( "#hits" ) . addClass ( "d-block" ) ;
215224 $ ( "#hits" ) . removeClass ( "d-none" ) ;
216225 $ ( ".search-overlay" ) . removeClass ( "d-none" ) ;
@@ -219,6 +228,7 @@ <h3 class="color-blue search-result-title">${item.title}</h3>
219228
220229 $ ( ".search-overlay" ) . on ( "click" , function ( ) {
221230 $ ( ".algolia-search" ) . removeClass ( "bg-lightblue" ) ;
231+ $ ( ".algolia-search" ) . removeClass ( "isfocused" ) ;
222232 $ ( "#hits" ) . removeClass ( "d-block" ) ;
223233 $ ( "#hits" ) . addClass ( "d-none" ) ;
224234 $ ( ".search-overlay" ) . addClass ( "d-none" ) ;
0 commit comments