diff --git a/package.json b/package.json index dc8407e..a0c1ed0 100644 --- a/package.json +++ b/package.json @@ -19,7 +19,6 @@ "axios": "^1.6.7", "dayjs": "^1.11.10", "firebase": "^10.8.0", - "framer-motion": "^11.3.12", "react": "^18.2.0", "react-dom": "^18.2.0", "react-photoswipe-gallery": "^3.0.1", diff --git a/src/components/CustomSearchBar.jsx b/src/components/CustomSearchBar.jsx index c034988..b4c2ec0 100644 --- a/src/components/CustomSearchBar.jsx +++ b/src/components/CustomSearchBar.jsx @@ -1,24 +1,18 @@ import { Select, MenuItem } from '@mui/material'; import CustomInput from "./CustomInput"; import { useProductsContext } from '../pages/Products/ProductsContext'; -import { ProductTypes, SearchOptions } from '../pages/Products/ProductsConstants'; +import { SearchOptions } from '../pages/Products/ProductsConstants'; +import BrandContainer from '../pages/Products/BrandViewer/BrandContainer'; +import CarModelListContainer from '../pages/Products/ModelViewer/CarModelContainer'; +import ProductContainer from '../pages/Products/ProductViewer/ProductContainer'; +import { getProductVerbiage } from '../util/generalUtils'; -const CustomSearchBar = () => { +const CustomSearchBar = ({ navigate }) => { const { searchOption, searchTerm, handleSearchOptionChange, setSearchTerm, productType } = useProductsContext(); - const handleSearchChange = (e) => { - const newSearchTerm = e.target.value; - setSearchTerm(newSearchTerm); - } let placeholder = ''; - let productVerbiage = 'Radiadores'; - - if (productType === ProductTypes.CAP) { - productVerbiage = 'Tapas'; - } else if (productType === ProductTypes.FAN) { - productVerbiage = 'Abanicos'; - } + let productVerbiage = getProductVerbiage(productType); if (searchOption === SearchOptions.BRANDS) { placeholder = 'Buscar marcas...'; @@ -28,12 +22,34 @@ const CustomSearchBar = () => { placeholder = `Buscar ${productVerbiage}...`; } + const handleSearchChange = (e) => { + const newSearchTerm = e.target.value; + setSearchTerm(newSearchTerm); + } + + const handleOptionChange = (option) => { + handleSearchOptionChange(option); + + switch (option) { + case SearchOptions.BRANDS: + navigate(, 'Marcas'); + break; + case SearchOptions.MODELS: + navigate(, 'Modelos'); + break; + case SearchOptions.PRODUCTS: + navigate(, productVerbiage); + break; + default: + break; + } + } return (