@@ -21,12 +21,12 @@ interface SearchBoxProps {
2121}
2222
2323const SearchBox = ( {
24- className = "" ,
25- placeholder = "Search documentation..." ,
26- minQueryLength = 2 ,
27- debounceTime = 300 ,
28- searchEndpoint = "/api/docs/search-index" ,
29- } : SearchBoxProps ) => {
24+ className = "" ,
25+ placeholder = "Search documentation..." ,
26+ minQueryLength = 2 ,
27+ debounceTime = 300 ,
28+ searchEndpoint = "/api/docs/search-index" ,
29+ } : SearchBoxProps ) => {
3030 const [ query , setQuery ] = useState ( "" ) ;
3131 const [ results , setResults ] = useState < SearchResult [ ] > ( [ ] ) ;
3232 const [ isLoading , setIsLoading ] = useState ( false ) ;
@@ -133,23 +133,23 @@ const SearchBox = ({
133133 type = "text"
134134 value = { query }
135135 onChange = { ( e ) => {
136- setQuery ( e . target . value )
137- setIsOpen ( true )
138- setSelectedIndex ( 0 )
136+ setQuery ( e . target . value ) ;
137+ setIsOpen ( true ) ;
138+ setSelectedIndex ( 0 ) ;
139139 } }
140140 onFocus = { ( ) => {
141- setIsOpen ( true )
142- setIsFocused ( true )
141+ setIsOpen ( true ) ;
142+ setIsFocused ( true ) ;
143143 } }
144144 onBlur = { ( ) => setIsFocused ( false ) }
145145 onKeyDown = { handleKeyDown }
146146 placeholder = { placeholder }
147147 className = { cn (
148- "w-full rounded-lg border bg-white px-4 py-2.5 pl-10 pr-10 text-sm transition-all duration-200 select-none outline-none " ,
148+ "w-full select-none rounded-lg border bg-white px-4 py-2.5 pl-10 pr-10 text-sm outline-none transition-all duration-200" ,
149149 isFocused || isOpen
150- ? "border-blue-500 ring-2 ring -blue-500/50 shadow-lg shadow -blue-500/20 dark:shadow-blue-500/10"
150+ ? "border-blue-500 shadow-lg shadow -blue-500/20 ring-2 ring -blue-500/50 dark:shadow-blue-500/10"
151151 : "border-gray-300 shadow-sm dark:border-gray-700" ,
152- "dark:bg-gray-800 dark:text-white placeholder:text-gray-400 dark:placeholder:text-gray-500"
152+ "placeholder:text-gray-400 dark:bg-gray-800 dark:text-white dark:placeholder:text-gray-500"
153153 ) }
154154 aria-label = "Search documentation"
155155 />
@@ -217,7 +217,7 @@ const SearchBox = ({
217217 className = "absolute z-50 mt-2 w-full overflow-hidden rounded-xl border border-gray-200 bg-white shadow-2xl dark:border-gray-700 dark:bg-gray-800"
218218 >
219219 { results . length > 0 ? (
220- < div className = "max-h-96 overflow-y-auto scrollbar-hide " >
220+ < div className = "scrollbar-hide max-h-96 overflow-y-auto" >
221221 { results . map ( ( result , index ) => (
222222 < motion . button
223223 key = { result . path }
@@ -230,7 +230,7 @@ const SearchBox = ({
230230 animate = { { opacity : 1 , x : 0 } }
231231 transition = { { delay : index * 0.03 } }
232232 className = { cn (
233- "w-full px-4 py-3 text-left transition-all select-none " ,
233+ "w-full select-none px-4 py-3 text-left transition-all" ,
234234 selectedIndex === index
235235 ? "bg-blue-50 dark:bg-blue-900/20"
236236 : "hover:bg-gray-50 dark:hover:bg-gray-700/50"
@@ -251,11 +251,11 @@ const SearchBox = ({
251251 >
252252 < Sparkles className = "h-4 w-4" />
253253 </ motion . div >
254- < div className = "flex-1 min-w-0" >
255- < div className = "font-semibold text-gray-900 dark:text-white truncate " >
254+ < div className = "min-w-0 flex-1 " >
255+ < div className = "truncate font-semibold text-gray-900 dark:text-white" >
256256 { result . title }
257257 </ div >
258- < div className = "text-xs text-gray-500 dark:text-gray-400 line-clamp-2 mt-0.5 " >
258+ < div className = "mt-0.5 line-clamp-2 text-xs text-gray-500 dark:text-gray-400" >
259259 { result . excerpt }
260260 </ div >
261261 </ div >
@@ -287,7 +287,7 @@ const SearchBox = ({
287287 < p className = "text-sm font-medium text-gray-700 dark:text-gray-300" >
288288 No results found
289289 </ p >
290- < p className = "text-xs text-gray-500 dark:text-gray-400 mt-1 " >
290+ < p className = "mt-1 text-xs text-gray-500 dark:text-gray-400" >
291291 Try different keywords
292292 </ p >
293293 </ motion . div >
0 commit comments