From e1bcb4b02252001f56a5316dc557e38fe30f48fc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?SwimJ=C3=A9j=C3=A9?= Date: Fri, 6 Dec 2024 05:35:47 +0100 Subject: [PATCH 1/4] Chaos Commit --- front/src/components/chaos/MonInput.tsx | 10 ++++ front/src/components/chaos/monButton.tsx | 19 +++++++ front/src/components/chaos/style.css | 11 ++++ front/src/pages/ChaosPage.tsx | 67 ++++++++++++++++++++++++ 4 files changed, 107 insertions(+) create mode 100644 front/src/components/chaos/MonInput.tsx create mode 100644 front/src/components/chaos/monButton.tsx create mode 100644 front/src/components/chaos/style.css create mode 100644 front/src/pages/ChaosPage.tsx diff --git a/front/src/components/chaos/MonInput.tsx b/front/src/components/chaos/MonInput.tsx new file mode 100644 index 0000000..184896e --- /dev/null +++ b/front/src/components/chaos/MonInput.tsx @@ -0,0 +1,10 @@ +//import { useState } from "react"; + +export default function MonInput({text, new_focus}) { + + return ( +
+ +
+ ) +} \ No newline at end of file diff --git a/front/src/components/chaos/monButton.tsx b/front/src/components/chaos/monButton.tsx new file mode 100644 index 0000000..9951303 --- /dev/null +++ b/front/src/components/chaos/monButton.tsx @@ -0,0 +1,19 @@ +import { useState } from "react"; + + + +export default function MonButton({letter,changetext,sizeFrontw,sizeFronth,rdmFront,color}) { + + + + function clicked() {rdmFront(); + changetext(letter)} + + + + return ( +
+ +
+ ) +} \ No newline at end of file diff --git a/front/src/components/chaos/style.css b/front/src/components/chaos/style.css new file mode 100644 index 0000000..6e3a951 --- /dev/null +++ b/front/src/components/chaos/style.css @@ -0,0 +1,11 @@ +#keys { + display: grid; + grid-template-columns: auto auto 1fr; + + +} + +.key { + font-size: 10px; + border: solid black; +} \ No newline at end of file diff --git a/front/src/pages/ChaosPage.tsx b/front/src/pages/ChaosPage.tsx new file mode 100644 index 0000000..d5f8beb --- /dev/null +++ b/front/src/pages/ChaosPage.tsx @@ -0,0 +1,67 @@ +import MonButton from "../components/chaos/monButton"; +import MonInput from "../components/chaos/MonInput"; +import "../components/chaos/style.css" +import { useState } from "react"; + + +export default function ChaosPage(){ + + const array_input = [1,2,3,4]; + const [array_letter,setArray_letter]=useState(["a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z"," ","!"]); + + const [sizeFrontw,setSizeFrontw] = useState(16) + const [sizeFronth,setSizeFronth] = useState(10) + const [color,setColor] = useState("#ffffff") + + function randomFront(){setSizeFronth(Math.floor(Math.random() * (1000))); + setSizeFrontw(Math.floor(Math.random() * (1000))); + setColor(`#${Math.floor(Math.random() * 16777215).toString(16)}`)} + + function shuffleArray(arr) { + for (let i = arr.length - 1; i > 0; i--) { + const j = Math.floor(Math.random() * (i + 1)); // Choisir un index aléatoire + [arr[i], arr[j]] = [arr[j], arr[i]]; // Échanger les éléments + } + return arr; + } + + const myArray = [1, 2, 3, 4, 5]; + const shuffledArray = shuffleArray(myArray); + + console.log(shuffledArray); // Affiche un tableau mélangé + + + const [entry1,setEntry1] = useState("champ1") + function E1(ent:string) { + setEntry1(entry1+ent); + } + const [connarddefocus,setFocus] = useState(()=>E1) + + const [entry2,setEntry2] = useState("champ2") + function E2(ent:string) { + setEntry2(entry2+ent); + } + + function changeFocus(E) { + setArray_letter(shuffleArray(array_letter)); + setFocus(()=>E); + } + + + return( +
+

Chaos Page

+ changeFocus(E1)}/> + changeFocus(E2)}/> +
+ {array_letter.map((letter) => {return })} +
+
+ ) +} \ No newline at end of file From ea2bb7ac3cc885fdcfaf70272d652184b97672a5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?SwimJ=C3=A9j=C3=A9?= Date: Fri, 6 Dec 2024 05:38:08 +0100 Subject: [PATCH 2/4] Second commit --- front/src/main.tsx | 2 ++ 1 file changed, 2 insertions(+) diff --git a/front/src/main.tsx b/front/src/main.tsx index ce00332..a7c672a 100644 --- a/front/src/main.tsx +++ b/front/src/main.tsx @@ -2,6 +2,7 @@ import { BrowserRouter, Route, Routes } from "react-router"; import { createRoot } from 'react-dom/client' import MainPage from "./pages/MainPage.tsx"; import GamePage from "./pages/GamePage.tsx"; +import ChaosPage from "./pages/ChaosPage.tsx"; createRoot(document.getElementById('root')!).render( @@ -9,6 +10,7 @@ createRoot(document.getElementById('root')!).render( } /> } /> + } /> , ) From 0e31e90af982fa9c615a85a0cd26e074cd63a55e Mon Sep 17 00:00:00 2001 From: iMax Date: Fri, 6 Dec 2024 05:58:13 +0100 Subject: [PATCH 3/4] =?UTF-8?q?Cr=C3=A9ation=20d'un=20formulaire=20basique?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- front/src/components/NavBar.tsx | 2 +- front/src/pages/ChaosPage.tsx | 16 +++++++++++++++- 2 files changed, 16 insertions(+), 2 deletions(-) diff --git a/front/src/components/NavBar.tsx b/front/src/components/NavBar.tsx index b5ebe21..cf2b130 100644 --- a/front/src/components/NavBar.tsx +++ b/front/src/components/NavBar.tsx @@ -7,7 +7,7 @@ export default function NavBar(){