feat: add search functionality to mobile navigation (#4487)

This commit is contained in:
KinfeMichael Tariku
2025-09-09 03:21:06 +03:00
committed by GitHub
parent 8286c03d0b
commit ab7d227b73
4 changed files with 39 additions and 3 deletions

View File

@@ -0,0 +1,33 @@
"use client";
import { Search } from "lucide-react";
import { useSearchContext } from "fumadocs-ui/provider";
import { Button } from "@/components/ui/button";
import { cn } from "@/lib/utils";
interface MobileSearchIconProps {
className?: string;
}
export function MobileSearchIcon({ className }: MobileSearchIconProps) {
const { setOpenSearch } = useSearchContext();
const handleSearchClick = () => {
setOpenSearch(true);
};
return (
<Button
variant="ghost"
size="icon"
aria-label="Search"
onClick={handleSearchClick}
className={cn(
"flex ring-0 shrink-0 md:hidden size-9 hover:bg-transparent",
className,
)}
>
<Search className="size-4" />
</Button>
);
}