@@ -91,70 +91,68 @@ export default function SearchBar() {
9191 return (
9292 < dialog
9393 ref = { dialog }
94- className = "m -auto bg-transparent p-0 backdrop:backdrop-blur-sm"
94+ className = "mx -auto mt-[10vh] bg-transparent p-0 backdrop:backdrop-blur-sm md:mt-[20vh] "
9595 // eslint-disable-next-line react/no-unknown-property
9696 closedby = "any"
9797 onClose = { handleClose }
9898 >
99- < section className = "relative w-full max-w-3xl rounded-lg bg-gray-800 p-6 shadow-lg md:w-[70vw]" >
100- < div
101- aria-haspopup = "listbox"
102- aria-controls = "search-results"
103- className = "h rounded-lg bg-gray-800 p-6 shadow-lg"
104- >
105- < div className = "relative" >
106- < input
107- value = { inputValue }
108- onChange = { handleInputChange }
109- autoFocus
110- type = "text"
111- placeholder = "What are you searching for?"
112- aria-label = "Search input"
113- className = "w-full rounded-sm border border-gray-700 bg-gray-700 p-2 pr-10 text-white placeholder-gray-400 focus:ring-2 focus:ring-blue-500 focus:outline-hidden"
114- />
115- < button
116- type = "button"
117- className = "absolute top-1/2 right-2 -translate-y-1/2 transform text-xs text-gray-400 hover:text-white"
118- onClick = { ( ) => {
119- dialog . current ?. close ( ) ;
120- } }
121- aria-label = "Close search"
122- >
123- < XCircleIcon className = "h-5 w-5" />
124- </ button >
125- </ div >
99+ < section className = "relative w-[85dvi] max-w-3xl rounded-lg bg-gray-800 p-4 md:w-[70vw] md:p-6" >
100+ < div className = "relative" >
101+ < input
102+ aria-haspopup = "listbox"
103+ aria-controls = "search-results"
104+ value = { inputValue }
105+ onChange = { handleInputChange }
106+ autoFocus
107+ type = "text"
108+ placeholder = "What are you searching for?"
109+ aria-label = "Search input"
110+ className = "w-full rounded-sm border border-gray-700 bg-gray-700 p-2 pr-10 text-white placeholder-gray-400 focus:ring-2 focus:ring-blue-500 focus:outline-hidden"
111+ />
112+ < button
113+ type = "button"
114+ className = "absolute top-1/2 right-2 -translate-y-1/2 transform text-xs text-gray-400 hover:text-white"
115+ onClick = { ( ) => {
116+ dialog . current ?. close ( ) ;
117+ } }
118+ aria-label = "Close search"
119+ >
120+ < XCircleIcon className = "h-5 w-5" />
121+ </ button >
122+ </ div >
123+ { inputValue . length > 0 && (
126124 < div
127125 id = "search-results"
128126 aria-live = "polite"
129127 aria-label = "Search results"
128+ className = "mt-6 transition duration-300 ease-in-out"
130129 >
131- { inputValue . length > 0 &&
132- ( isLoading ? (
133- < div className = "flex items-center justify-center p-4" >
134- < ArrowPathIcon className = "h-5 w-5 animate-spin text-gray-400" />
135- < span className = "sr-only" > Searching</ span >
136- </ div >
137- ) : (
138- < SearchResults
139- items = { items }
140- onSelectItem = { ( item ) => {
141- dialog . current ?. close ( ) ;
142- sendSelectItemEvent ( {
143- list : {
144- id : "search_results" ,
145- name : "Search Results" ,
146- } ,
147- item : {
148- item_id : item . path ,
149- item_name : item . title ,
150- item_category : item . type ,
151- } ,
152- } ) ;
153- } }
154- />
155- ) ) }
130+ { isLoading ? (
131+ < div className = "flex items-center justify-center" >
132+ < ArrowPathIcon className = "h-5 w-5 animate-spin text-gray-400" />
133+ < span className = "sr-only" > Searching</ span >
134+ </ div >
135+ ) : (
136+ < SearchResults
137+ items = { items }
138+ onSelectItem = { ( item ) => {
139+ dialog . current ?. close ( ) ;
140+ sendSelectItemEvent ( {
141+ list : {
142+ id : "search_results" ,
143+ name : "Search Results" ,
144+ } ,
145+ item : {
146+ item_id : item . path ,
147+ item_name : item . title ,
148+ item_category : item . type ,
149+ } ,
150+ } ) ;
151+ } }
152+ />
153+ ) }
156154 </ div >
157- </ div >
155+ ) }
158156 </ section >
159157 </ dialog >
160158 ) ;
0 commit comments