feat: minor fixes (#355)

This commit is contained in:
Kalidou Diagne
2025-04-25 18:19:32 +03:00
committed by GitHub
parent c33f1aa260
commit acaf8b90cb
3 changed files with 18 additions and 2 deletions

View File

@@ -2,12 +2,26 @@
import { Search } from "lucide-react"
import { Button, ButtonProps } from "@/components/ui/button"
import { useEffect, useState } from "react"
import { searchConfig } from "@/hooks/useGlobalSearch"
interface SearchButtonProps extends ButtonProps {
onClick: () => void
}
const { allIndexes, searchClient } = searchConfig
export function SearchButton({ onClick, ...props }: SearchButtonProps) {
const [disabled, setDisabled] = useState(false)
useEffect(() => {
if (!searchClient || allIndexes.length === 0) {
console.warn(
"Algolia credentials (NEXT_PUBLIC_ALGOLIA_APP_ID, NEXT_PUBLIC_ALGOLIA_SEARCH_API_KEY) or indexes are not configured. Search will not work."
)
setDisabled(true)
}
}, [])
return (
<Button
variant="search"
@@ -15,6 +29,7 @@ export function SearchButton({ onClick, ...props }: SearchButtonProps) {
onClick={onClick}
aria-label="Open search"
className="w-full text-left justify-start"
disabled={disabled}
{...props}
>
<div className="flex items-center gap-2">

View File

@@ -327,10 +327,11 @@ export const SearchModal = ({ open, setOpen }: SearchModalProps) => {
value={searchQuery}
onChange={handleSearchInputChange}
className="w-full p-2 text-black"
disabled={directSearchMode}
autoFocus
/>
</div>
<div className="max-h-[60vh] overflow-y-auto mt-4">
<div className="max-h-[80vh] lg:max-h-[60vh] overflow-y-auto mt-4">
{directSearchMode ? (
<DirectSearchResults query={searchQuery} setOpen={setOpen} />
) : (

View File

@@ -32,7 +32,7 @@ export const HomepageHeader = ({ lang }: { lang: any }) => {
</div>
}
actions={
<div className="flex flex-col lg:flex-row gap-10">
<div className="flex flex-col gap-4 lg:flex-row lg:gap-10">
<Link href={"/research"} className="flex items-center gap-2 group">
<Button className="w-full sm:w-auto">
<div className="flex items-center gap-1">