From 8f1d2b65849ab767b0052f85810dcd47b9af3980 Mon Sep 17 00:00:00 2001 From: victorAnumudu Date: Wed, 21 Jun 2023 10:02:47 +0100 Subject: [PATCH] market category toggle position changed --- src/components/Helpers/SelectBox/index.jsx | 4 +- src/components/MarketPlace/MainSection.jsx | 43 +++++++++++++--------- 2 files changed, 28 insertions(+), 19 deletions(-) diff --git a/src/components/Helpers/SelectBox/index.jsx b/src/components/Helpers/SelectBox/index.jsx index c2fa678..512ab36 100644 --- a/src/components/Helpers/SelectBox/index.jsx +++ b/src/components/Helpers/SelectBox/index.jsx @@ -1,7 +1,7 @@ import React, { useState } from "react"; import useToggle from "../../../hooks/useToggle"; -function SelectBox({ datas = [], className, action, contentBodyClasses }) { +function SelectBox({ datas = [], className, action, contentBodyClasses, position }) { const [item, setItem] = useState(datas[0]); // custom hook const [toggle, setToggle] = useToggle(false); @@ -49,7 +49,7 @@ function SelectBox({ datas = [], className, action, contentBodyClasses }) {
diff --git a/src/components/MarketPlace/MainSection.jsx b/src/components/MarketPlace/MainSection.jsx index 4f22f3a..90eb038 100644 --- a/src/components/MarketPlace/MainSection.jsx +++ b/src/components/MarketPlace/MainSection.jsx @@ -3,6 +3,7 @@ import DataIteration from "../Helpers/DataIteration"; import AvailableJobsCard from "../Cards/AvailableJobsCard"; import ListView from '../../assets/images/list-view.png' import GridView from '../../assets/images/grid-view.svg' +import SelectBox from "../Helpers/SelectBox"; export default function MainSection({ className, @@ -27,6 +28,16 @@ export default function MainSection({ const tabHandler = (value) => { setTab(value); }; + + // Handles the category selection on mobile view + const handleSetCategory = (value) => { + for (let i in marketCategories) { + if (marketCategories[i] == value) { + setTab(i); + } + } + }; + useEffect(() => { if (tab === "All") { setProducts(marketPlaceProduct); @@ -41,21 +52,9 @@ export default function MainSection({ return (
- {/* contentDisplay toggler */} -
-
- setContentDisplay((prev)=>prev=='grid'? 'list' : 'grid')} - src={contentDisplay=='grid'? ListView : GridView} - className="w-full h-full cursor-pointer" alt="view" - /> -
-
- {/* end of contentDisplay toggler */} -
-
-
+
+
+
{mappedArray.map(({ key, value }) => ( ))}
+ {/* market categories on screen smaller than large screen */} +
+ +
{/* contentDisplay toggler */} - {/*
+
setContentDisplay((prev)=>prev=='grid'? 'list' : 'grid')} src={contentDisplay=='grid'? ListView : GridView} className="w-full h-full cursor-pointer" alt="view" /> -
*/} +
{/* end of contentDisplay toggler */}