import { useState } from "react"; import { Input } from "../ui/input"; import { Button } from "../ui/button"; import { t } from "@/utils"; import { useSearchParams } from "next/navigation"; const BudgetFilter = () => { const searchParams = useSearchParams(); const [budget, setBudget] = useState({ minPrice: searchParams.get("min_price") || "", maxPrice: searchParams.get("max_price") || "", }); const { minPrice, maxPrice } = budget; const handleMinMaxPrice = () => { const newSearchParams = new URLSearchParams(searchParams); newSearchParams.set("min_price", minPrice); newSearchParams.set("max_price", maxPrice); window.history.pushState(null, "", `/ads?${newSearchParams.toString()}`); }; return (
setBudget((prev) => ({ ...prev, minPrice: Number(e.target.value) })) } value={minPrice} /> setBudget((prev) => ({ ...prev, maxPrice: Number(e.target.value) })) } value={maxPrice} />
); }; export default BudgetFilter;