Skip to content

Commit

Permalink
Update SearchBar.jsx
Browse files Browse the repository at this point in the history
  • Loading branch information
dev-priyanshu15 authored Dec 19, 2024
1 parent c25a003 commit 8b91ed5
Showing 1 changed file with 32 additions and 2 deletions.
34 changes: 32 additions & 2 deletions src/components/SearchBar.jsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,33 @@
// import { useState } from "react";
// import { FaSearch } from "react-icons/fa";
// import { useNavigate } from "react-router-dom";

// export default function SearchBar() {
// const [query, setQuery] = useState("");
// const navigate = useNavigate();

// const handleSubmit = (e) => {
// e.preventDefault();
// if (query.trim()) {
// navigate(`/search/${query.trim()}`);
// }
// };

// return (
// <form onSubmit={handleSubmit} className="flex items-center gap-2">
// <input
// type="text"
// placeholder="Search"
// value={query}
// onChange={(e) => setQuery(e.target.value)}
// className="px-3 py-2 rounded-md focus:outline-none focus:ring focus:border-blue-600 flex-1"
// />
// <button type="submit" className="px-4 py-2 bg-blue-600 text-black rounded-md">
// <FaSearch />
// </button>
// </form>
// );
// }
import { useState } from "react";
import { FaSearch } from "react-icons/fa";
import { useNavigate } from "react-router-dom";
Expand All @@ -20,9 +50,9 @@ export default function SearchBar() {
placeholder="Search"
value={query}
onChange={(e) => setQuery(e.target.value)}
className="px-3 py-2 rounded-md focus:outline-none focus:ring focus:border-blue-600 flex-1"
className="px-3 py-2 rounded-md focus:outline-none focus:ring focus:border-blue-600 flex-1 text-black" // Added text-black
/>
<button type="submit" className="px-4 py-2 bg-blue-600 text-black rounded-md">
<button type="submit" className="px-4 py-2 bg-blue-600 text-white rounded-md">
<FaSearch />
</button>
</form>
Expand Down

0 comments on commit 8b91ed5

Please sign in to comment.