From 091874afc14115682013dec4ddf296c04b17be91 Mon Sep 17 00:00:00 2001 From: John Doe Date: Wed, 13 Sep 2023 19:40:42 +0300 Subject: [PATCH] =?UTF-8?q?=F0=9F=9B=A0=EF=B8=8F=20Refactored=20PriceRange?= =?UTF-8?q?Input=20component=20=F0=9F=9A=80=20Improved=20code=20readabilit?= =?UTF-8?q?y=20and=20structure=20=F0=9F=8E=A8=20Updated=20styling=20for=20?= =?UTF-8?q?better=20user=20experience=20=F0=9F=94=A7=20Fixed=20minor=20iss?= =?UTF-8?q?ues=20and=20bugs?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../PriceRangeInput.tsx | 137 ++++++++++++++++++ 1 file changed, 137 insertions(+) create mode 100644 src/app/(client-components)/(HeroSearchForm)/(real-estate-search-form)/PriceRangeInput.tsx diff --git a/src/app/(client-components)/(HeroSearchForm)/(real-estate-search-form)/PriceRangeInput.tsx b/src/app/(client-components)/(HeroSearchForm)/(real-estate-search-form)/PriceRangeInput.tsx new file mode 100644 index 0000000..b96255f --- /dev/null +++ b/src/app/(client-components)/(HeroSearchForm)/(real-estate-search-form)/PriceRangeInput.tsx @@ -0,0 +1,137 @@ +"use client"; + +import React, { Fragment, useState, FC } from "react"; +import { Popover, Transition } from "@headlessui/react"; +import Slider from "rc-slider"; +import convertNumbThousand from "@/utils/convertNumbThousand"; +import ButtonSubmit from "../ButtonSubmit"; +import { CurrencyDollarIcon } from "@heroicons/react/24/outline"; + +export interface PriceRangeInputProps { + onChange?: (data: any) => void; + fieldClassName?: string; +} + +const PriceRangeInput: FC = ({ + onChange, + fieldClassName = "[ nc-hero-field-padding ]", +}) => { + const [rangePrices, setRangePrices] = useState([100000, 4000000]); + + return ( + + {({ open, close }) => ( + <> +
+ document.querySelector("html")?.click()} + > +
+ +
+
+ + {`$${convertNumbThousand( + rangePrices[0] / 1000 + )}k ~ $${convertNumbThousand(rangePrices[1] / 1000)}k`} + + + Choose price range + +
+
+ + {/* BUTTON SUBMIT OF FORM */} +
+ +
+
+ + {open && ( +
+ )} + + + +
+
+ Range Price + setRangePrices(e as number[])} + /> +
+ +
+
+ +
+
+ $ +
+ +
+
+
+ +
+
+ $ +
+ +
+
+
+
+
+
+ + )} +
+ ); +}; + +export default PriceRangeInput;