From 6d693a3d23e2d59d25531b9a79153964378246a4 Mon Sep 17 00:00:00 2001 From: DavidBelisle <79233327+DavidBelisle@users.noreply.github.com> Date: Mon, 7 Nov 2022 16:28:11 -0500 Subject: [PATCH] =?UTF-8?q?Un=20bon=20d=C3=A9but?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/components/Ajouter.js | 57 +++++++-- .../src/components/Modify.js | 56 +++++++-- .../src/pages/ContactUs.js | 108 +++++++++--------- .../src/pages/Formulaire.js | 2 +- .../src/pages/Inventaire.js | 8 +- .../src/stylesheets/site.css | 7 ++ 6 files changed, 159 insertions(+), 79 deletions(-) diff --git a/GrossesMitaines/grosses-mitaines-ui/src/components/Ajouter.js b/GrossesMitaines/grosses-mitaines-ui/src/components/Ajouter.js index 5a909e1..464e73b 100644 --- a/GrossesMitaines/grosses-mitaines-ui/src/components/Ajouter.js +++ b/GrossesMitaines/grosses-mitaines-ui/src/components/Ajouter.js @@ -1,9 +1,12 @@ import { useState, useEffect } from "react"; import { Dropdown } from "react-bootstrap"; import { Button } from "react-bootstrap"; +import { useForm } from "react-hook-form"; const Ajouter = ({ onCreation }) => { + const { register, handleSubmit, formState: { errors } } = useForm(); + const [currentStatus, setStatus] = useState("Disponible"); const [title, setTitle] = useState(""); @@ -27,9 +30,7 @@ const Ajouter = ({ onCreation }) => { }, [imageFile]); - const handleSubmit = (e) => { - e.preventDefault(); // Empêcher de reloader la page au submit. - + const onSubmit = () => { // Appeler le comportement onCreation onCreation({ title: title, @@ -63,50 +64,86 @@ const Ajouter = ({ onCreation }) => { return (