diff --git a/GrossesMitaines/grosses-mitaines-ui/src/components/FeaturedList.js b/GrossesMitaines/grosses-mitaines-ui/src/components/FeaturedList.js
index 86380ff..ba7a41a 100644
--- a/GrossesMitaines/grosses-mitaines-ui/src/components/FeaturedList.js
+++ b/GrossesMitaines/grosses-mitaines-ui/src/components/FeaturedList.js
@@ -1,21 +1,25 @@
import { Carousel } from "react-bootstrap";
+import { Link } from "react-router-dom";
const FeaturedList = ({ products }) => {
if (products === null)
return (<>>);
return (
{products.map((product) => (
+
-
-
- {product.title}
- {product.description}
- Seulement
- {product.promoPrice} $ CA
-
+
+
+
+ {product.title}
+ {product.description}
+ Seulement
+ {product.promoPrice} $ CA
+
+
))}
diff --git a/GrossesMitaines/grosses-mitaines-ui/src/components/ResearchBar.js b/GrossesMitaines/grosses-mitaines-ui/src/components/ResearchBar.js
index 7783435..32185b6 100644
--- a/GrossesMitaines/grosses-mitaines-ui/src/components/ResearchBar.js
+++ b/GrossesMitaines/grosses-mitaines-ui/src/components/ResearchBar.js
@@ -1,6 +1,6 @@
import { useState } from 'react';
import { useNavigate } from 'react-router-dom';
-
+import { useEffect } from 'react';
const ResearchBar = () => {
@@ -8,8 +8,9 @@ const ResearchBar = () => {
const navigate = useNavigate();
const [value, setValue] = useState("");
+
const search = async (query) => {
- navigate('/morceaux', { state: { query: query} });
+ navigate('/morceaux', { state: { query: query } });
}
const handleValueChange = async (value) => {
@@ -18,7 +19,15 @@ const ResearchBar = () => {
return (
-
handleValueChange(e.target.value)} placeholder="Rechercher...">
+
{
+ if (e.key === "Enter") {
+ search(value);
+ }
+ }}
+ value={value}
+ onChange={(e) => handleValueChange(e.target.value)}
+ placeholder="Rechercher...">
diff --git a/GrossesMitaines/grosses-mitaines-ui/src/pages/Morceaux.js b/GrossesMitaines/grosses-mitaines-ui/src/pages/Morceaux.js
index 243f016..8267658 100644
--- a/GrossesMitaines/grosses-mitaines-ui/src/pages/Morceaux.js
+++ b/GrossesMitaines/grosses-mitaines-ui/src/pages/Morceaux.js
@@ -1,10 +1,10 @@
-import { Button } from 'react-bootstrap';
import { useEffect } from "react";
import ItemList from "../components/ItemList";
import { useState } from 'react';
import Sorting from "../components/Sorting"
import Filters from '../components/Filters';
import { useLocation } from 'react-router-dom';
+import ResearchBar from "../components/ResearchBar";
const Morceaux = () => {
@@ -21,6 +21,7 @@ const Morceaux = () => {
useEffect(() => {
document.title = 'Morceaux';
setIsLoading(true);
+ setIsSearch(false);
async function fetchData(isSearch) {
@@ -30,8 +31,7 @@ const Morceaux = () => {
const response = await fetch(url);
const json = await response.json();
- if (json.length > 0)
- setProducts([...json]);
+ setProducts([...json]);
}
@@ -45,7 +45,7 @@ const Morceaux = () => {
}
setIsLoading(false);
- }, []);
+ }, [state]);
const handleNextItems = async () => {
@@ -107,6 +107,7 @@ const Morceaux = () => {
return (
+
@@ -121,11 +122,6 @@ const Morceaux = () => {
- {/*
- {!isSearch && }
-
*/}
);
}