diff --git a/app/components/SearchModal.tsx b/app/components/SearchModal.tsx index 96fa94f53..e08f3b38a 100644 --- a/app/components/SearchModal.tsx +++ b/app/components/SearchModal.tsx @@ -9,12 +9,14 @@ import { Configure, useRefinementList, useInstantSearch, + Pagination, } from 'react-instantsearch' import { liteClient } from 'algoliasearch/lite' import { MdClose, MdSearch } from 'react-icons/md' import { Link, useRouterState } from '@tanstack/react-router' import { useSearchContext } from '~/contexts/SearchContext' import { frameworkOptions, libraries } from '~/libraries' +import { capitalize } from '~/utils/utils' const searchClient = liteClient( 'FQ0DQ6MA3C', @@ -111,7 +113,7 @@ const Hit = ({ hit, isFocused }: { hit: any; isFocused?: boolean }) => { tabIndex={-1} ref={ref} > -
+

@@ -134,26 +136,26 @@ const Hit = ({ hit, isFocused }: { hit: any; isFocused?: boolean }) => {

) : null}

-
- {(() => { - const framework = frameworkOptions.find((f) => - hit.url.includes(`/framework/${f.value}`) - ) - if (!framework) return null - - return ( + {(() => { + const framework = frameworkOptions.find((f) => + hit.url.includes(`/framework/${f.value}`) + ) + if (!framework) return null + + return ( +
{framework.label} - {framework.label} + {capitalize(framework.label)}
- ) - })()} -
-
+
+ ) + })()} + ) } @@ -204,7 +206,10 @@ function LibraryRefinement() { : 'bg-gray-100 dark:bg-gray-800 text-gray-600 dark:text-gray-400 hover:bg-gray-200 dark:hover:bg-gray-700' )} > - {item.label} ({item.count.toLocaleString()}) + {capitalize(item.label)}{' '} + + ({item.count.toLocaleString()}) + ) })} @@ -271,7 +276,10 @@ function FrameworkRefinement() { : 'bg-gray-100 dark:bg-gray-800 text-gray-600 dark:text-gray-400 hover:bg-gray-200 dark:hover:bg-gray-700' )} > - {item.label} ({item.count.toLocaleString()}) + {capitalize(item.label)}{' '} + + ({item.count.toLocaleString()}) + ) })} @@ -389,8 +397,8 @@ export function SearchModal() { onKeyDown={handleKeyDown} >
- -
+ +
@@ -470,6 +478,16 @@ function SearchResults({ focusedIndex }: { focusedIndex: number }) { return }} /> + ul]:w-full [&>ul]:flex [&>ul]:justify-center [&>ul]:gap-2 lg:[&>ul]:gap-4', + '[&_li>*]:px-3 [&_li>*]:py-1.5', + '[&_li>span]:cursor-not-allowed', + '[&_.ais-Pagination-item--selected>*]:bg-emerald-500 [&_.ais-Pagination-item--selected>*]:text-white [&_.ais-Pagination-item--selected>*]:rounded-lg' + )} + />
)