From faf141db42e3a42d52d31e7cb4c1ff5486ef6233 Mon Sep 17 00:00:00 2001 From: Pierre Ferreira Date: Mon, 13 Nov 2023 10:49:34 +0100 Subject: [PATCH] ajout d'un theme global pour toutes les couleurs primaire, secondaire et quelque texte principaux :lipstick: --- cryptide_project/src/App.tsx | 34 ++++++++------ .../src/Components/BigButtonNav.tsx | 11 ++++- .../src/Components/ButtonImgNav.css | 8 ++-- .../src/Components/ButtonImgNav.tsx | 5 ++- cryptide_project/src/Components/ChoiceBar.css | 3 +- cryptide_project/src/Components/ChoiceBar.tsx | 5 ++- cryptide_project/src/Components/NavBar.css | 3 +- cryptide_project/src/Components/NavBar.tsx | 16 ++++--- .../src/Components/PersonStatus.tsx | 8 +++- cryptide_project/src/Pages/EndGame.css | 2 +- cryptide_project/src/Pages/EndGame.tsx | 10 ++++- cryptide_project/src/Pages/Home.css | 4 +- cryptide_project/src/Pages/Home.tsx | 12 ++++- cryptide_project/src/Pages/InGame.css | 4 +- cryptide_project/src/Pages/InGame.tsx | 44 +++++++++++++++---- cryptide_project/src/Pages/Lobby.css | 6 +-- cryptide_project/src/Pages/Lobby.tsx | 12 ++++- cryptide_project/src/Pages/Play.css | 9 ++-- cryptide_project/src/Pages/Play.tsx | 10 +++-- cryptide_project/src/Style/Color.tsx | 10 +++++ cryptide_project/src/Style/Global.css | 2 +- cryptide_project/src/Style/Theme.tsx | 13 ++++++ cryptide_project/src/Style/ThemeContext.tsx | 15 +++++++ 23 files changed, 183 insertions(+), 63 deletions(-) create mode 100644 cryptide_project/src/Style/Color.tsx create mode 100644 cryptide_project/src/Style/Theme.tsx create mode 100644 cryptide_project/src/Style/ThemeContext.tsx diff --git a/cryptide_project/src/App.tsx b/cryptide_project/src/App.tsx index 0f43e87..2765a15 100644 --- a/cryptide_project/src/App.tsx +++ b/cryptide_project/src/App.tsx @@ -23,6 +23,9 @@ import { BrowserRouter, Route, Routes, useLocation } from "react-router-dom"; /* Style */ import './App.css'; +import { ThemeProvider } from './Style/ThemeContext'; +// import theme from './Style/Theme'; + /* bootstrap */ import 'bootstrap/dist/css/bootstrap.min.css'; @@ -58,22 +61,25 @@ function App() { // logo // // + //@ts-ignore - - {/* */} - {hasNavbarVisible && } - - } /> - } /> - } /> - } /> - } /> - } /> - } /> - } /> - - + + + {/* */} + {hasNavbarVisible && } + + } /> + } /> + } /> + } /> + } /> + } /> + } /> + } /> + + + ); } diff --git a/cryptide_project/src/Components/BigButtonNav.tsx b/cryptide_project/src/Components/BigButtonNav.tsx index 6f4af20..bc8087b 100644 --- a/cryptide_project/src/Components/BigButtonNav.tsx +++ b/cryptide_project/src/Components/BigButtonNav.tsx @@ -3,11 +3,20 @@ import { Link } from 'react-router-dom'; import './ButtonImgNav.css'; import { FormattedMessage } from 'react-intl'; +import { useTheme } from '../Style/ThemeContext'; +import COLORS from '../Style/Color'; //@ts-ignore function BigButtonNav({ dest, img}) { + + const theme = useTheme(); + + // const mystyle = { + // backgroundColor: "#0064E0", + // }; + return ( - diff --git a/cryptide_project/src/Components/ButtonImgNav.css b/cryptide_project/src/Components/ButtonImgNav.css index 4f69b15..e625ce2 100644 --- a/cryptide_project/src/Components/ButtonImgNav.css +++ b/cryptide_project/src/Components/ButtonImgNav.css @@ -3,8 +3,8 @@ width: auto; height: 65px; - background-color: #85C9C2; - color: #2A4541; + /* background-color: #85C9C2; */ + /* color: #2A4541; */ border-radius: 15px; border-width: 0; @@ -20,8 +20,8 @@ width: auto; height: 100px; - background-color: #85C9C2; - color: #2A4541; + /* background-color: #85C9C2; */ + /* color: #2A4541; */ border-radius: 15px; border-width: 0; diff --git a/cryptide_project/src/Components/ButtonImgNav.tsx b/cryptide_project/src/Components/ButtonImgNav.tsx index 6e3e78d..cd5b8d0 100644 --- a/cryptide_project/src/Components/ButtonImgNav.tsx +++ b/cryptide_project/src/Components/ButtonImgNav.tsx @@ -3,11 +3,14 @@ import { Link } from 'react-router-dom'; import './ButtonImgNav.css'; import { FormattedMessage } from 'react-intl'; +import { useTheme } from '../Style/ThemeContext'; + //@ts-ignore function ButtonImgNav({ dest, img, text = "" }) { + const theme = useTheme(); return ( {/*target='_blank' ==> ouvre un nouvelle onglet*/ } - diff --git a/cryptide_project/src/Components/ChoiceBar.css b/cryptide_project/src/Components/ChoiceBar.css index 94a86a2..5eedba2 100644 --- a/cryptide_project/src/Components/ChoiceBar.css +++ b/cryptide_project/src/Components/ChoiceBar.css @@ -13,10 +13,9 @@ .choice-bar-button { margin: 5px; padding: 10px; - background-color: lightseagreen; + /* background-color: lightseagreen; */ color: #fff; border: 2px solid grey; border-radius: 5px; cursor: pointer; } - \ No newline at end of file diff --git a/cryptide_project/src/Components/ChoiceBar.tsx b/cryptide_project/src/Components/ChoiceBar.tsx index baafc29..6769f62 100644 --- a/cryptide_project/src/Components/ChoiceBar.tsx +++ b/cryptide_project/src/Components/ChoiceBar.tsx @@ -1,15 +1,16 @@ import React from 'react'; import './ChoiceBar.css'; +import { useTheme } from '../Style/ThemeContext'; const ChoiceBar = () => { const players = ['Player1', 'Player2', 'Player3']; - + const theme = useTheme(); return (

Quel joueur voulez-vous interroger ?

{players.map((player, index) => ( - ))} diff --git a/cryptide_project/src/Components/NavBar.css b/cryptide_project/src/Components/NavBar.css index ad887b9..c1854e9 100644 --- a/cryptide_project/src/Components/NavBar.css +++ b/cryptide_project/src/Components/NavBar.css @@ -1,6 +1,6 @@ .custom-navbar{ - background-color: #85C9C2; + /* background-color: #85C9C2; */ color: #fff; text-emphasis-color: #fff; } @@ -17,7 +17,6 @@ .navbar-title-dd a { - background-color: #2A4541; color: #fff; border-radius: 15; padding: 10px 20px; /* Ajustez le rembourrage selon vos préférences */ diff --git a/cryptide_project/src/Components/NavBar.tsx b/cryptide_project/src/Components/NavBar.tsx index 9f88892..98fff75 100644 --- a/cryptide_project/src/Components/NavBar.tsx +++ b/cryptide_project/src/Components/NavBar.tsx @@ -14,21 +14,25 @@ import { HiLanguage } from 'react-icons/hi2'; /* Components */ import './NavBar.css'; +/* Style */ +import { useTheme } from '../Style/ThemeContext'; + // @ts-ignore function AppNavbar({changeLocale}) { + const theme = useTheme(); return ( - +
-

Cryptide

-
by Crypteam
+

Cryptide

+
by Crypteam