From 0f9393d3e68c1ccbcf50a71588bbeecd4d92ee7d Mon Sep 17 00:00:00 2001 From: alexsparkes Date: Fri, 14 Jun 2024 00:06:11 +0100 Subject: [PATCH] refactor: move search away from marketplace --- src/components/Elements/MainModal/Main.jsx | 59 +++++++++++++++---- .../marketplace/components/Items/Items.jsx | 33 ++++++++++- src/features/marketplace/views/Browse.jsx | 34 +---------- 3 files changed, 83 insertions(+), 43 deletions(-) diff --git a/src/components/Elements/MainModal/Main.jsx b/src/components/Elements/MainModal/Main.jsx index 6a3ac866..d4402e0c 100644 --- a/src/components/Elements/MainModal/Main.jsx +++ b/src/components/Elements/MainModal/Main.jsx @@ -1,6 +1,13 @@ import variables from 'config/variables'; import { Suspense, lazy, useState, memo } from 'react'; -import { MdSettings, MdOutlineShoppingBasket, MdOutlineExtension, MdClose } from 'react-icons/md'; +import { + MdSettings, + MdOutlineShoppingBasket, + MdOutlineExtension, + MdClose, + MdSearch, + MdOutlineKeyboardArrowRight, +} from 'react-icons/md'; import { motion, AnimatePresence } from 'framer-motion'; import { Button } from 'components/Elements'; @@ -152,7 +159,7 @@ let tabs = [ function MainModal({ modalClose }) { let [activeTab, setActiveTab] = useState(tabs[0].id); - let [subTab, setSubTab] = useState(""); + let [subTab, setSubTab] = useState(''); let [direction, setDirection] = useState(1); const variants = { @@ -188,6 +195,7 @@ function MainModal({ modalClose }) { setDirection(newIndex > currentIndex ? 1 : -1); setActiveTab(type); + setSubTab(''); }; const renderTab = () => { @@ -204,13 +212,44 @@ function MainModal({ modalClose }) { return ( <>
-
- {navbarLogo} - {subTab} -
+
+
+ {navbarLogo} +
+ {activeTab} + {subTab !== '' && ( + <> + + {subTab} + + )} +
+
+
+ + {activeTab === 'marketplace' && ( + +
+ this.setState({ filter: event.target.value })} + className="h-[40px] block w-full px-4 ps-10 text-sm text-gray-900 border border-[#484848] rounded-lg bg-gray-50 focus:ring-blue-500 focus:border-blue-500 dark:bg-white/5 dark:placeholder-gray-400 dark:text-white dark:focus:ring-blue-500 dark:focus:border-neutral-100" + /> +
+ +
+
+
+ )} +
{tabs.map((tab) => (
)} +
+
{ + this.setState({ type: 'all' }); + this.getItems(); + }} + className="transition-all duration-200 bg-white rounded-full px-6 py-2 text-base text-black" + > + All +
+
{ + this.setState({ type: 'photo_packs' }); + this.getItems(); + }} + className="transition-all duration-200 bg-[#333] hover:bg-[#222222] cursor-pointer rounded-full px-6 py-2 text-base text-white" + > + Photo Packs +
+
{ + this.setState({ type: 'quote_packs' }); + this.getItems(); + }} + className="transition-all duration-200 bg-[#333] hover:bg-[#222222] cursor-pointer rounded-full px-6 py-2 text-base text-white" + > + Quote Packs +
+
{items ?.filter((item) => filterItems(item, filter)) diff --git a/src/features/marketplace/views/Browse.jsx b/src/features/marketplace/views/Browse.jsx index 305d6bf3..e4feead8 100644 --- a/src/features/marketplace/views/Browse.jsx +++ b/src/features/marketplace/views/Browse.jsx @@ -385,7 +385,7 @@ class Marketplace extends PureComponent { ) : ( <> -
+ {/*
{variables.getMessage('modals.main.navbar.marketplace')} @@ -424,38 +424,10 @@ class Marketplace extends PureComponent { }, ]} /> -
+
*/} )} -
-
{ - this.setState({ type: 'all' }); - this.getItems(); - }} - className="transition-all duration-200 bg-white rounded-full px-6 py-2 text-base text-black" - > - All -
-
{ - this.setState({ type: 'photo_packs' }); - this.getItems(); - }} - className="transition-all duration-200 bg-[#333] hover:bg-[#222222] cursor-pointer rounded-full px-6 py-2 text-base text-white" - > - Photo Packs -
-
{ - this.setState({ type: 'quote_packs' }); - this.getItems(); - }} - className="transition-all duration-200 bg-[#333] hover:bg-[#222222] cursor-pointer rounded-full px-6 py-2 text-base text-white" - > - Quote Packs -
-
+ {this.props.type === 'collections' && !this.state.collection ? ( this.state.items.map((item) => !item.news ? (