diff --git a/src/components/search-bar.tsx b/src/components/search-bar.tsx index eea475f..27e68e7 100644 --- a/src/components/search-bar.tsx +++ b/src/components/search-bar.tsx @@ -5,6 +5,7 @@ import { cn } from "@/lib/utils" import { Search } from "lucide-react" import { useRouter } from "next/navigation" import { useState } from "react" +import { Button } from "./ui/button" export function SearchBar({ navbar }: { navbar?: boolean }) { const [input, setInput] = useState("") @@ -13,14 +14,6 @@ export function SearchBar({ navbar }: { navbar?: boolean }) { async function handleSearch(e: React.FormEvent) { e.preventDefault() - // const validatedPlayer = await validatePlayer(input.trim()) - // - // if (validatedPlayer.error === true) { - // toast.error(validatedPlayer.message) - // setInput("") - // return - // } - if (input.trim()) { router.push(`/player/${encodeURIComponent(input.trim())}`) } @@ -29,25 +22,25 @@ export function SearchBar({ navbar }: { navbar?: boolean }) { } } - const handleKeyDown = (e: React.KeyboardEvent) => { - if (e.key === "Enter") { - handleSearch(e) - } - } - return (
-
- +
setInput(e.target.value)} - onKeyDown={handleKeyDown} + onKeyDown={(e) => { + if (e.key === "Enter") { + handleSearch(e) + } + }} /> +