From 8150a80766c98069e1989107e291a405ec4025a0 Mon Sep 17 00:00:00 2001 From: Vanessa Lai Date: Tue, 25 Jun 2024 02:26:54 +0800 Subject: [PATCH] fixed some css --- src/components/header/Header.jsx | 4 ++++ src/components/searchbar/Searchbar.jsx | 20 ++++++++++---------- src/pages/search/SearchPage.jsx | 3 ++- 3 files changed, 16 insertions(+), 11 deletions(-) diff --git a/src/components/header/Header.jsx b/src/components/header/Header.jsx index e9c56f6..0af96df 100644 --- a/src/components/header/Header.jsx +++ b/src/components/header/Header.jsx @@ -111,6 +111,7 @@ function Header() {
  • Register/ Login
  • ) ) : ( + currentUser ? ( <>
    @@ -135,6 +136,9 @@ function Header() {

    profile

    + ) : ( +
  • Register/ Login
  • + ) )} diff --git a/src/components/searchbar/Searchbar.jsx b/src/components/searchbar/Searchbar.jsx index f1e6717..5f91c71 100644 --- a/src/components/searchbar/Searchbar.jsx +++ b/src/components/searchbar/Searchbar.jsx @@ -5,18 +5,18 @@ import { useNavigate } from 'react-router-dom'; import './Searchbar.css'; const SearchBar = () => { - const [query, setQuery] = useState(''); - const navigate = useNavigate(); + const [query, setQuery] = useState(''); + const navigate = useNavigate(); - const handleInputChange = (e) => { - const value = e.target.value; - setQuery(value); - }; + const handleInputChange = (e) => { + const value = e.target.value; + setQuery(value); + }; - const handleSearch = (e) => { - e.preventDefault(); - navigate(`/search?query=${query}`); - }; + const handleSearch = (e) => { + e.preventDefault(); + navigate(`/search?query=${query}`); + }; return (
    diff --git a/src/pages/search/SearchPage.jsx b/src/pages/search/SearchPage.jsx index 6363021..f6873ee 100644 --- a/src/pages/search/SearchPage.jsx +++ b/src/pages/search/SearchPage.jsx @@ -134,8 +134,9 @@ function SearchPage() { if (!query) return products; const searchQuery = query.toLowerCase(); + console.log(searchQuery); return products.filter(product => { - const name = product.name ? product.name.toLowerCase() : ''; + const name = product.title ? product.title.toLowerCase() : ''; const productType = product.productType ? product.productType.toLowerCase() : ''; const description = product.description ? product.description.toLowerCase() : ''; const username = product.username ? product.username.toLowerCase() : '';