diff --git a/GrossesMitaines/grosses-mitaines-ui/package-lock.json b/GrossesMitaines/grosses-mitaines-ui/package-lock.json index 00c5061..25c4431 100644 --- a/GrossesMitaines/grosses-mitaines-ui/package-lock.json +++ b/GrossesMitaines/grosses-mitaines-ui/package-lock.json @@ -11,12 +11,14 @@ "@testing-library/jest-dom": "^5.16.5", "@testing-library/react": "^13.4.0", "@testing-library/user-event": "^13.5.0", + "axios": "^1.1.3", "bootstrap": "^5.2.1", "font-awesome": "^4.7.0", "react": "^18.2.0", "react-bootstrap": "^2.5.0", "react-devtools": "^4.26.0", "react-dom": "^18.2.0", + "react-icons": "^4.6.0", "react-router-dom": "^6.4.1", "react-scripts": "^5.0.1", "react-transition-group": "^4.4.5", @@ -5128,6 +5130,29 @@ "node": ">=4" } }, + "node_modules/axios": { + "version": "1.1.3", + "resolved": "https://registry.npmjs.org/axios/-/axios-1.1.3.tgz", + "integrity": "sha512-00tXVRwKx/FZr/IDVFt4C+f9FYairX517WoGCL6dpOntqLkZofjhu43F/Xl44UOpqa+9sLFDrG/XAnFsUYgkDA==", + "dependencies": { + "follow-redirects": "^1.15.0", + "form-data": "^4.0.0", + "proxy-from-env": "^1.1.0" + } + }, + "node_modules/axios/node_modules/form-data": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/form-data/-/form-data-4.0.0.tgz", + "integrity": "sha512-ETEklSGi5t0QMZuiXoA/Q6vcnxcLQP5vdugSpuAyi6SVGi2clPPp+xgEhuMaHC+zGgn31Kd235W35f7Hykkaww==", + "dependencies": { + "asynckit": "^0.4.0", + "combined-stream": "^1.0.8", + "mime-types": "^2.1.12" + }, + "engines": { + "node": ">= 6" + } + }, "node_modules/axobject-query": { "version": "2.2.0", "resolved": "https://registry.npmjs.org/axobject-query/-/axobject-query-2.2.0.tgz", @@ -14824,6 +14849,11 @@ "node": ">= 0.10" } }, + "node_modules/proxy-from-env": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/proxy-from-env/-/proxy-from-env-1.1.0.tgz", + "integrity": "sha512-D+zkORCbA9f1tdWRK0RaCR3GPv50cMxcrz4X8k5LTSUD1Dkw47mKJEZQNunItRTkWwgtaUSo1RVFRIG9ZXiFYg==" + }, "node_modules/pseudomap": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/pseudomap/-/pseudomap-1.0.2.tgz", @@ -15230,6 +15260,14 @@ "resolved": "https://registry.npmjs.org/react-error-overlay/-/react-error-overlay-6.0.11.tgz", "integrity": "sha512-/6UZ2qgEyH2aqzYZgQPxEnz33NJ2gNsnHA2o5+o4wW9bLM/JYQitNP9xPhsXwC08hMMovfGe/8retsdDsczPRg==" }, + "node_modules/react-icons": { + "version": "4.6.0", + "resolved": "https://registry.npmjs.org/react-icons/-/react-icons-4.6.0.tgz", + "integrity": "sha512-rR/L9m9340yO8yv1QT1QurxWQvWpbNHqVX0fzMln2HEb9TEIrQRGsqiNFQfiv9/JEUbyHmHPlNTB2LWm2Ttz0g==", + "peerDependencies": { + "react": "*" + } + }, "node_modules/react-is": { "version": "17.0.2", "resolved": "https://registry.npmjs.org/react-is/-/react-is-17.0.2.tgz", @@ -22101,6 +22139,28 @@ "resolved": "https://registry.npmjs.org/axe-core/-/axe-core-4.4.3.tgz", "integrity": "sha512-32+ub6kkdhhWick/UjvEwRchgoetXqTK14INLqbGm5U2TzBkBNF3nQtLYm8ovxSkQWArjEQvftCKryjZaATu3w==" }, + "axios": { + "version": "1.1.3", + "resolved": "https://registry.npmjs.org/axios/-/axios-1.1.3.tgz", + "integrity": "sha512-00tXVRwKx/FZr/IDVFt4C+f9FYairX517WoGCL6dpOntqLkZofjhu43F/Xl44UOpqa+9sLFDrG/XAnFsUYgkDA==", + "requires": { + "follow-redirects": "^1.15.0", + "form-data": "^4.0.0", + "proxy-from-env": "^1.1.0" + }, + "dependencies": { + "form-data": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/form-data/-/form-data-4.0.0.tgz", + "integrity": "sha512-ETEklSGi5t0QMZuiXoA/Q6vcnxcLQP5vdugSpuAyi6SVGi2clPPp+xgEhuMaHC+zGgn31Kd235W35f7Hykkaww==", + "requires": { + "asynckit": "^0.4.0", + "combined-stream": "^1.0.8", + "mime-types": "^2.1.12" + } + } + } + }, "axobject-query": { "version": "2.2.0", "resolved": "https://registry.npmjs.org/axobject-query/-/axobject-query-2.2.0.tgz", @@ -28964,6 +29024,11 @@ } } }, + "proxy-from-env": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/proxy-from-env/-/proxy-from-env-1.1.0.tgz", + "integrity": "sha512-D+zkORCbA9f1tdWRK0RaCR3GPv50cMxcrz4X8k5LTSUD1Dkw47mKJEZQNunItRTkWwgtaUSo1RVFRIG9ZXiFYg==" + }, "pseudomap": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/pseudomap/-/pseudomap-1.0.2.tgz", @@ -29270,6 +29335,12 @@ "resolved": "https://registry.npmjs.org/react-error-overlay/-/react-error-overlay-6.0.11.tgz", "integrity": "sha512-/6UZ2qgEyH2aqzYZgQPxEnz33NJ2gNsnHA2o5+o4wW9bLM/JYQitNP9xPhsXwC08hMMovfGe/8retsdDsczPRg==" }, + "react-icons": { + "version": "4.6.0", + "resolved": "https://registry.npmjs.org/react-icons/-/react-icons-4.6.0.tgz", + "integrity": "sha512-rR/L9m9340yO8yv1QT1QurxWQvWpbNHqVX0fzMln2HEb9TEIrQRGsqiNFQfiv9/JEUbyHmHPlNTB2LWm2Ttz0g==", + "requires": {} + }, "react-is": { "version": "17.0.2", "resolved": "https://registry.npmjs.org/react-is/-/react-is-17.0.2.tgz", diff --git a/GrossesMitaines/grosses-mitaines-ui/package.json b/GrossesMitaines/grosses-mitaines-ui/package.json index c55bcea..a3c66b9 100644 --- a/GrossesMitaines/grosses-mitaines-ui/package.json +++ b/GrossesMitaines/grosses-mitaines-ui/package.json @@ -6,12 +6,14 @@ "@testing-library/jest-dom": "^5.16.5", "@testing-library/react": "^13.4.0", "@testing-library/user-event": "^13.5.0", + "axios": "^1.1.3", "bootstrap": "^5.2.1", "font-awesome": "^4.7.0", "react": "^18.2.0", "react-bootstrap": "^2.5.0", "react-devtools": "^4.26.0", "react-dom": "^18.2.0", + "react-icons": "^4.6.0", "react-router-dom": "^6.4.1", "react-scripts": "^5.0.1", "react-transition-group": "^4.4.5", diff --git a/GrossesMitaines/grosses-mitaines-ui/src/components/Ajouter.js b/GrossesMitaines/grosses-mitaines-ui/src/components/Ajouter.js new file mode 100644 index 0000000..91ad91a --- /dev/null +++ b/GrossesMitaines/grosses-mitaines-ui/src/components/Ajouter.js @@ -0,0 +1,81 @@ +import { useState } from "react" + +const Ajouter = ({ onCreation }) => { + + const [title, setTitle] = useState(""); + const [description, setDescription] = useState(""); + const [category, setCategory] = useState(""); + const [price, setPrice] = useState(""); + const [quantity, setQuantity] = useState(""); + const [imageName, setImageName] = useState("sqdc.jpg"); + + const handleSubmit = (e) => { + e.preventDefault(); // Empêcher de reloader la page au submit. + + // Appeler le comportement onCreation + onCreation({ title, description, category, price, quantity, imageName }) + + // Reset les états du formulaire. + setTitle("") + setDescription("") + setCategory("") + setPrice("") + setQuantity("") + setImageName("sqdc.jpg") + } + + + return ( +
+
+

Ajouter un morceau

+
+ + setTitle(e.target.value)} /> +
+
+ + setDescription(e.target.value)} /> +
+
+ + setCategory(e.target.value)} /> +
+
+ + setPrice(e.target.value)} /> +
+
+ + setQuantity(e.target.value)} /> +
+
+ + setImageName(e.target.value)} /> +
+ + +
+
+ ) +} + +export default Ajouter \ No newline at end of file diff --git a/GrossesMitaines/grosses-mitaines-ui/src/components/App.js b/GrossesMitaines/grosses-mitaines-ui/src/components/App.js index 74b4be8..c6b05d1 100644 --- a/GrossesMitaines/grosses-mitaines-ui/src/components/App.js +++ b/GrossesMitaines/grosses-mitaines-ui/src/components/App.js @@ -6,6 +6,7 @@ import Privacy from "../pages/Privacy"; import ContactUs from "../pages/ContactUs"; import Morceaux from "../pages/Morceaux"; import MorceauDetail from "../pages/MorceauDetail"; +import Inventaire from "../pages/Inventaire"; const App = () => { @@ -19,6 +20,7 @@ const App = () => { }/> }/> }/> + }/> diff --git a/GrossesMitaines/grosses-mitaines-ui/src/components/Button.js b/GrossesMitaines/grosses-mitaines-ui/src/components/Button.js new file mode 100644 index 0000000..73def42 --- /dev/null +++ b/GrossesMitaines/grosses-mitaines-ui/src/components/Button.js @@ -0,0 +1,9 @@ +const Button = ({text, color, onClick}) => { + return ( + + ) +}; + +export default Button; \ No newline at end of file diff --git a/GrossesMitaines/grosses-mitaines-ui/src/components/ContactForm.js b/GrossesMitaines/grosses-mitaines-ui/src/components/ContactForm.js index 870a2f7..e10af1c 100644 --- a/GrossesMitaines/grosses-mitaines-ui/src/components/ContactForm.js +++ b/GrossesMitaines/grosses-mitaines-ui/src/components/ContactForm.js @@ -7,28 +7,28 @@ const ContactForm = () =>{
- + {/* */}
- + {/* */}
- + {/* */}
-