diff --git a/src/User/components/DownArrow/downArrow.jsx b/src/User/components/DownArrow/downArrow.jsx index 0bd157005..e5896799b 100644 --- a/src/User/components/DownArrow/downArrow.jsx +++ b/src/User/components/DownArrow/downArrow.jsx @@ -3,7 +3,7 @@ import "../../pages/Home/Home.css"; import Arrow from "../../../assets/arrow.png"; // Make sure to update the path to your actual image location -const DownArrow = () => { +const DownArrow = ({scrollToCategories}) => { return (
{ src={Arrow} alt="Down Arrow" id="arrow" + onClick={scrollToCategories} />
); diff --git a/src/User/pages/Home/Home.jsx b/src/User/pages/Home/Home.jsx index 0af876329..47af53400 100644 --- a/src/User/pages/Home/Home.jsx +++ b/src/User/pages/Home/Home.jsx @@ -131,6 +131,7 @@ const latestProducts = [ const Home = () => { const sectionRef = useRef(null); + const categoriesRef = useRef(null); const [searchTerm, setSearchTerm] = useState(""); const [suggestions, setSuggestions] = useState([]); const navigate = useNavigate(); @@ -163,6 +164,10 @@ const Home = () => { sectionRef.current.scrollIntoView({ behavior: "smooth" }); }; + const scrollToCategories=()=>{ + categoriesRef.current.scrollIntoView({behavior:"smooth"}); + } + const handleSubscribe = (e) => { e.preventDefault(); @@ -220,12 +225,12 @@ const Home = () => { className="bg-green-700 text-white px-6 sm:px-8 py-2 sm:py-3 rounded-full text-base sm:text-lg font-semibold hover:bg-green-800 transition duration-300"> Shop Now - + {/* Popular Categories */} -
+

Popular Categories