From dd3e001c90a567ca6af801517a3f77d0a3eda227 Mon Sep 17 00:00:00 2001 From: Telkens Date: Thu, 19 Oct 2023 16:15:08 -0500 Subject: [PATCH 1/2] =?UTF-8?q?Corregido=20error=20que=20provocaba=20que?= =?UTF-8?q?=20se=20rompiera=20la=20aplicaci=C3=B3n=20al=20momento=20de=20c?= =?UTF-8?q?ambiar=20filtros?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/app/container_page.tsx | 2 +- src/components/containerCards/containerCards.tsx | 3 ++- src/components/filters/index.tsx | 4 ++-- 3 files changed, 5 insertions(+), 4 deletions(-) diff --git a/src/app/container_page.tsx b/src/app/container_page.tsx index d12fa54..9c9454d 100644 --- a/src/app/container_page.tsx +++ b/src/app/container_page.tsx @@ -29,7 +29,7 @@ export function ContainerPage({
{pathname !== '/' && } {pathname === '/products' ? ( -
+
diff --git a/src/components/containerCards/containerCards.tsx b/src/components/containerCards/containerCards.tsx index d6a6841..9091b22 100644 --- a/src/components/containerCards/containerCards.tsx +++ b/src/components/containerCards/containerCards.tsx @@ -8,7 +8,7 @@ export function TopSellers() { const products = productos.slice(0, 10); return ( -
+

Lo más vendidos

@@ -17,6 +17,7 @@ export function TopSellers() { const { title, id, price, image } = producto; return ( { key={category.id} onClick={() => { updateBody('categoryId', category.id) - products.length ? updateBody('page', 1) : updateBody('page', 0) + products.length && updateBody('page', 1); }} > @@ -126,7 +126,7 @@ const Filters = () => { key={brand.id} onClick={() => { updateBody('brandId', brand.id) - products.length ? updateBody('page', 1) : updateBody('page', 0) + products.length && updateBody('page', 1); }} > From ac032931ac316ca90977bbc0424fad3a9de2d8df Mon Sep 17 00:00:00 2001 From: Telkens Date: Thu, 19 Oct 2023 18:34:34 -0500 Subject: [PATCH 2/2] Fix bug in Navbar --- src/components/navBar/navBar.tsx | 73 +++++++++++++++----------------- 1 file changed, 34 insertions(+), 39 deletions(-) diff --git a/src/components/navBar/navBar.tsx b/src/components/navBar/navBar.tsx index 85cd1f8..4762439 100644 --- a/src/components/navBar/navBar.tsx +++ b/src/components/navBar/navBar.tsx @@ -1,11 +1,10 @@ 'use client'; import Image from 'next/image'; -import React, { FC, useState, useRef } from 'react'; +import React, { FC, useState } from 'react'; import Link from 'next/link'; import { Images } from '~/assets/img'; import Icon from '~/assets/icons/icon'; import MenuMobile from './MenuMobile'; -import { InputField } from '../inputs/InputField'; import { ThemeModeButton } from '../ThemeMode'; import { MainButton } from '../button/button'; import { useFlagState } from '~/hooks/useFlagState'; @@ -21,8 +20,6 @@ const NavBar: FC = ({}) => { const [isOpenMenu, setIsOpenMenu] = useState(false); const [flagState, updateState] = useFlagState(false); - const searchBarRef = useRef(null); - const toggleNavbar = () => { setIsOpenMenu(!isOpenMenu); }; @@ -30,14 +27,20 @@ const NavBar: FC = ({}) => { const products = useProductStore((state) => state.products); const clearSearchBar = () => { - if (searchBarRef.current) { - searchBarRef.current.value = ''; // Clear the input value + const searchBar: HTMLInputElement | null | HTMLElement = + document.getElementById('searchBar'); + if (searchBar !== null && searchBar instanceof HTMLInputElement) { + searchBar.value = ''; } }; - const pathname = usePathname() + const pathname = usePathname(); return (