diff --git a/Frontend/src/CSS/UserProfile.css b/Frontend/src/CSS/UserProfile.css index 4212886..f44754d 100644 --- a/Frontend/src/CSS/UserProfile.css +++ b/Frontend/src/CSS/UserProfile.css @@ -86,7 +86,7 @@ .logo-out, .change-photo { padding: 15px 20px; - margin: 10px; + border: none; cursor: pointer; background-color: var(--color-6); @@ -102,20 +102,18 @@ } .userProfile-subheading { - font-size: 3rem; + font-size: 1.7rem; } .userProfile-paragraph { - font-size: 2rem; + font-size: 1.4rem; } - .buttons { - margin-bottom: 25px; - } .reset-password, .logo-out, .change-photo { + width: 300px; padding: 10px 15px; font-size: 0.9rem; } diff --git a/Frontend/src/Pages/CustomDropdown.css b/Frontend/src/Pages/CustomDropdown.css new file mode 100644 index 0000000..8f597ee --- /dev/null +++ b/Frontend/src/Pages/CustomDropdown.css @@ -0,0 +1,56 @@ +.custom-dropdown { + position: relative; + display: flex; + justify-content: center; + align-items: center; + padding: 5px 5px; + background-color: rgba(217, 148, 249, 0.519); +} + +.custom-dropdown-header { + display: flex; + width: 400px; + height: 100%; + justify-content: space-between; + align-items: center; + cursor: pointer; + margin: 0px; + padding: 10px; + + background-color: rgb(248, 235, 255); + border: 1px solid #ccc; + border-radius: 4px; +} + +.custom-dropdown-selected { + flex-grow: 1; +} + +.custom-dropdown-arrow { + margin-left: 10px; +} + +.custom-dropdown-options { + position: absolute; + top: 100%; + left: 0; + right: 0; + z-index: 10; + background-color: rgba(228, 152, 245, 0.563); + border: 1px solid #ccc; + backdrop-filter: blur(30px); + border-radius: 4px; + box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1); + margin-top: 5px; +} + +.custom-dropdown-option { + padding: 10px; + cursor: pointer; + border-bottom: 1px solid rgba(50, 0, 56, 0.227); +} + +.custom-dropdown-option:hover { + background-color: var(--color-hover); + color: #fff; +} diff --git a/Frontend/src/Pages/CustomDropdown.jsx b/Frontend/src/Pages/CustomDropdown.jsx new file mode 100644 index 0000000..5d3ef04 --- /dev/null +++ b/Frontend/src/Pages/CustomDropdown.jsx @@ -0,0 +1,35 @@ +import React from 'react'; +import './CustomDropdown.css'; + +const CustomDropdown = ({ className, options, onChange, value, isOpen, setIsOpen }) => { + const handleOptionClick = (optionValue) => { + onChange(optionValue); + setIsOpen(false); + }; + + return ( +
+
setIsOpen(!isOpen)}> +
+ {options.find((option) => option.value === value)?.label || 'Select'} +
+
+
+ {isOpen && ( +
+ {options.map((option) => ( +
handleOptionClick(option.value)} + > + {option.label} +
+ ))} +
+ )} +
+ ); +}; + +export default CustomDropdown; diff --git a/Frontend/src/Pages/Product.jsx b/Frontend/src/Pages/Product.jsx index feb5c05..0d91c72 100644 --- a/Frontend/src/Pages/Product.jsx +++ b/Frontend/src/Pages/Product.jsx @@ -4,6 +4,7 @@ import "../CSS/Product.css"; import Loader from "../Components/Loader"; import ProductDetail from "../Components/ProductDetail"; import toast from "react-hot-toast"; +import CustomDropdown from "./CustomDropdown"; const Product = () => { const [loading, setLoading] = useState(true); @@ -16,6 +17,8 @@ const Product = () => { const [selectedCategory, setSelectedCategory] = useState(""); const [sortByDate, setSortByDate] = useState(""); + const [openDropdown, setOpenDropdown] = useState(null); + useEffect(() => { axios .get("https://ecommerce-backend-0wr7.onrender.com/ecommerce/product") @@ -113,36 +116,50 @@ const Product = () => { onChange={(e) => setSearchText(e.target.value)} />
- - - + isOpen={openDropdown === "sortByDate"} + setIsOpen={(isOpen) => + setOpenDropdown(isOpen ? "sortByDate" : null) + } + />
{loading ? (