11import  {  DocSearchModal ,  DocSearchProps ,  useDocSearchKeyboardEvents  }  from  '@docsearch/react' 
2+ import  {  keyframes  }  from  '@emotion/react' 
23import  {  useCallback ,  useRef ,  useState  }  from  'react' 
34import  {  createPortal  }  from  'react-dom' 
45import  {  Global  }  from  'theme-ui' 
@@ -12,6 +13,7 @@ import {
1213  FontSize , 
1314  FontWeight , 
1415  Icon , 
16+   LineHeight , 
1517  Link , 
1618  Opacity , 
1719  Responsive , 
@@ -20,6 +22,11 @@ import {
2022  useTheme , 
2123}  from  '@edgeandnode/gds' 
2224
25+ const  animationFadeIn  =  keyframes ( { 
26+   from : {  opacity : 0  } , 
27+   to : {  opacity : 1  } , 
28+ } ) 
29+ 
2330export  function  DocSearch ( props : DocSearchProps )  { 
2431  const  searchButtonRef  =  useRef < HTMLButtonElement > ( null ) 
2532  const  [ isOpen ,  setIsOpen ]  =  useState ( false ) 
@@ -153,30 +160,33 @@ export function DocSearch(props: DocSearchProps) {
153160                '--docsearch-spacing' : '0 !important' , 
154161                '--docsearch-container-background' : `${ theme . colors ! . Midnight88 }   !important` , 
155162                '--docsearch-modal-width' : 'min(calc(100vw - 32px), 840px) !important' , 
156-                 '--docsearch-modal-background' : '#292738  !important' , 
163+                 '--docsearch-modal-background' : ` ${ theme . colors ! . Tooltip }   !important` , 
157164                '--docsearch-modal-shadow' : 'none !important' , 
158-                 '--docsearch-searchbox-height' : ' 96px !important', 
165+                 '--docsearch-searchbox-height' : [ '64px !important' ,   null ,   ' 96px !important'] , 
159166                '--docsearch-searchbox-focus-background' : 'transparent !important' , 
160167                '--docsearch-searchbox-shadow' : 'none !important' , 
161168                '--docsearch-hit-background' : 'transparent !important' , 
162169                '--docsearch-hit-color' : `${ theme . colors ! . White88 }   !important` , 
163170                '--docsearch-hit-active-color' : `${ theme . colors ! . White }   !important` , 
164171                '--docsearch-highlight-color' : `${ theme . colors ! . Purple }   !important` , 
165172              } , 
173+               '.DocSearch-Container' : { 
174+                 animation : `${ animationFadeIn }   150ms ease-in-out` , 
175+               } , 
166176              '.DocSearch-Modal' : { 
167177                m : [ null ,  null ,  '96px auto auto' ] , 
168-                 border : buildBorder ( 'White8' ) , 
178+                 border : [ null ,   null ,   'White8' ] , 
169179                overflow : 'hidden' , 
170180                cursor : 'default' , 
171181              } , 
172182              '.DocSearch-SearchBar' : { 
173-                 p : `0 ${ Spacing [ '24px' ] }  ` , 
183+                 p : [ `0 ${ Spacing [ '16px'  ] } `  ,   null ,   `0  ${ Spacing [ ' 24px'] }  `] , 
174184                '&::after' : { 
175185                  content : `''` , 
176186                  zIndex : 100 , 
177187                  position : 'absolute' , 
178-                   left : Spacing [ '24px' ] , 
179-                   right : Spacing [ '24px' ] , 
188+                   left : [ Spacing [ '16px'  ] ,   null ,   Spacing [ ' 24px'] ] , 
189+                   right : [ Spacing [ '16px'  ] ,   null ,   Spacing [ ' 24px'] ] , 
180190                  bottom : '-1px' , 
181191                  borderBottom : buildBorder ( 'White16' ) , 
182192                  bg : 'var(--docsearch-modal-background)' , 
@@ -188,10 +198,15 @@ export function DocSearch(props: DocSearchProps) {
188198              '.DocSearch-MagnifierLabel, .DocSearch-LoadingIndicator' : { 
189199                color : 'white' , 
190200                svg : { 
191-                   width : '18px ' , 
192-                   height : '18px ' , 
201+                   width : '20px ' , 
202+                   height : '20px ' , 
193203                } , 
194204              } , 
205+               '.DocSearch-Search-Icon' : { 
206+                 left : '3px' , 
207+                 color : 'transparent' , 
208+                 backgroundImage : `url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" style="fill: white;"><path fill-rule="evenodd" clip-rule="evenodd" d="M6.70768 1C9.85995 1 12.4154 3.55542 12.4154 6.70768C12.4154 8.08963 11.9242 9.35686 11.107 10.3444C11.3349 10.5734 11.6474 10.8859 12.0424 11.2809L12.4833 11.7218C13.1109 12.3494 13.8972 13.1357 14.8423 14.0808C15.0526 14.2911 15.0526 14.632 14.8423 14.8423C14.632 15.0526 14.2911 15.0526 14.0808 14.8423L10.3444 11.107C9.35686 11.9242 8.08963 12.4154 6.70768 12.4154C3.55542 12.4154 1 9.85995 1 6.70768C1 3.55542 3.55542 1 6.70768 1ZM6.70768 2.07692C4.15018 2.07692 2.07692 4.15018 2.07692 6.70768C2.07692 9.26518 4.15018 11.3384 6.70768 11.3384C9.26518 11.3384 11.3384 9.26518 11.3384 6.70768C11.3384 4.15018 9.26518 2.07692 6.70768 2.07692Z" /></svg>')` , 
209+               } , 
195210              '.DocSearch-Input' : { 
196211                p : `${ Spacing [ '32px' ] }   ${ Spacing [ '16px' ] }  ` , 
197212                outline : 'none' , 
@@ -232,9 +247,10 @@ export function DocSearch(props: DocSearchProps) {
232247              '.DocSearch-Hit-source' : { 
233248                m : 0 , 
234249                mb : Spacing [ '2px' ] , 
235-                 p : `0  ${ Spacing [ '16px' ] }  ` , 
250+                 p : `${ Spacing [ '8px' ] }   ${ Spacing [ '16px' ] }  ` , 
236251                fontWeight : FontWeight . MEDIUM , 
237252                fontSize : FontSize [ '12px' ] , 
253+                 lineHeight : LineHeight . TIGHT , 
238254                textTransform : 'uppercase' , 
239255                letterSpacing : '0.15em' , 
240256                color : 'White32' , 
@@ -327,8 +343,19 @@ export function DocSearch(props: DocSearchProps) {
327343              } , 
328344              '.DocSearch-NoResults-Prefill-List' : { 
329345                p : 0 , 
330-                 mt : Spacing [ '32px ' ] , 
346+                 mt : Spacing [ '48px ' ] , 
331347                textAlign : 'center' , 
348+                 ul : { 
349+                   display : 'flex' , 
350+                   flexDirection : 'column' , 
351+                   gap : Spacing [ '8px' ] , 
352+                   li : { 
353+                     listStyle : 'none' , 
354+                   } , 
355+                 } , 
356+               } , 
357+               '.DocSearch-Prefill' : { 
358+                 fontWeight : FontWeight . REGULAR , 
332359              } , 
333360            } } 
334361          /> 
0 commit comments