From 3c54b1c2f774763a183e44c5127801c1f5c63e17 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 | 3 ++ .../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 | 1 + 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 | 10 ++++- cryptide_project/src/Pages/Play.css | 9 ++-- cryptide_project/src/Pages/Play.tsx | 18 +++++++- 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, 172 insertions(+), 45 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 6d4b96f..815207c 100644 --- a/cryptide_project/src/App.tsx +++ b/cryptide_project/src/App.tsx @@ -24,6 +24,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'; 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 5f15a61..a9c2f95 100644 --- a/cryptide_project/src/Components/ChoiceBar.tsx +++ b/cryptide_project/src/Components/ChoiceBar.tsx @@ -2,6 +2,7 @@ import React from 'react'; import { useGame } from '../Contexts/GameContext'; import { socket } from '../SocketConfig'; import './ChoiceBar.css'; +import { useTheme } from '../Style/ThemeContext'; const ChoiceBar = () => { const { players, nodeId } = useGame(); diff --git a/cryptide_project/src/Components/NavBar.css b/cryptide_project/src/Components/NavBar.css index efd28bd..c1854e9 100644 --- a/cryptide_project/src/Components/NavBar.css +++ b/cryptide_project/src/Components/NavBar.css @@ -1,6 +1,6 @@ .custom-navbar{ - background-color: #0064E0; + /* 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