diff --git a/webapp/package-lock.json b/webapp/package-lock.json index 5b8a3e86..5027553c 100644 --- a/webapp/package-lock.json +++ b/webapp/package-lock.json @@ -20,6 +20,7 @@ "react": "^18.2.0", "react-bootstrap": "^2.10.1", "react-dom": "^18.2.0", + "react-icons": "^5.0.1", "react-router-dom": "^6.22.3", "react-scripts": "5.0.1", "web-vitals": "^3.5.1" @@ -23552,6 +23553,14 @@ } } }, + "node_modules/react-icons": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/react-icons/-/react-icons-5.0.1.tgz", + "integrity": "sha512-WqLZJ4bLzlhmsvme6iFdgO8gfZP17rfjYEJ2m9RsZjZ+cc4k1hTzknEz63YS1MeT50kVzoa1Nz36f4BEx+Wigw==", + "peerDependencies": { + "react": "*" + } + }, "node_modules/react-is": { "version": "17.0.2", "resolved": "https://registry.npmjs.org/react-is/-/react-is-17.0.2.tgz", diff --git a/webapp/package.json b/webapp/package.json index 92dd07b9..bf5957f3 100644 --- a/webapp/package.json +++ b/webapp/package.json @@ -15,6 +15,7 @@ "react": "^18.2.0", "react-bootstrap": "^2.10.1", "react-dom": "^18.2.0", + "react-icons": "^5.0.1", "react-router-dom": "^6.22.3", "react-scripts": "5.0.1", "web-vitals": "^3.5.1" diff --git a/webapp/public/favicon.ico b/webapp/public/favicon.ico index a11777cc..edb3375f 100644 Binary files a/webapp/public/favicon.ico and b/webapp/public/favicon.ico differ diff --git a/webapp/public/faviconReact.ico b/webapp/public/faviconReact.ico new file mode 100644 index 00000000..a11777cc Binary files /dev/null and b/webapp/public/faviconReact.ico differ diff --git a/webapp/public/logoGitHub.png b/webapp/public/logoGitHub.png new file mode 100644 index 00000000..1b6499e0 Binary files /dev/null and b/webapp/public/logoGitHub.png differ diff --git a/webapp/src/App.js b/webapp/src/App.js index da6dc6ff..7d2fddce 100644 --- a/webapp/src/App.js +++ b/webapp/src/App.js @@ -1,4 +1,4 @@ -import React from 'react'; +import React, {useState,useEffect} from 'react'; import Navbar from './components/navbar/NavBar'; import AddUser from './components/adduser/AddUser'; import Login from './components/login/Login'; @@ -8,8 +8,7 @@ import StartButton from './components/startbutton/StartButton'; import Game from './components/game/Game'; import Home from './components/home/Home'; import Footer from './components/footer/Footer'; -import { ChakraProvider } from '@chakra-ui/react'; - +import { ChakraProvider } from "@chakra-ui/react"; import AuthenticatedLayout from './components/authenticationLayout'; import GuestLayout from './components/GuestLayout'; import Logout from './components/logout/Logout'; @@ -17,11 +16,25 @@ import History from './components/history/History'; import {BasicGameMode } from './components/game/gameModes/basicGameMode'; import {GameProvider} from './components/game/GameContext'; import PrincipalView from './components/principalView/PrincipalView'; + const App = () => { + + const [darkMode, setDarkMode] = useState(false); + + useEffect(() => { + if (darkMode) { + document.body.classList.add('dark-mode'); + console.log('dark mode'); + } else { + document.body.classList.remove('dark-mode'); + console.log('light mode'); + } + }, [darkMode]); + return ( - + @@ -37,7 +50,7 @@ const App = () => { } /> - + } /> ( ); diff --git a/webapp/src/components/game/AnswerButton.jsx b/webapp/src/components/game/AnswerButton.jsx index 97ce1cb8..bed20d97 100644 --- a/webapp/src/components/game/AnswerButton.jsx +++ b/webapp/src/components/game/AnswerButton.jsx @@ -1,11 +1,13 @@ import {Button} from '@chakra-ui/react' -export function AnswerButton({text, colorFondo, onClick}){ +export function AnswerButton({darkMode,text, colorFondo, onClick}){ + + let textColor = darkMode.darkMode? "#FCFAF0" : "#08313A"; return( + {isLoggedIn() ? ( <> diff --git a/webapp/src/index.js b/webapp/src/index.js index 3ea19f16..29d225c0 100644 --- a/webapp/src/index.js +++ b/webapp/src/index.js @@ -3,10 +3,12 @@ import ReactDOM from 'react-dom'; import './index.css'; import App from './App'; import reportWebVitals from './reportWebVitals'; +import { ColorModeScript } from "@chakra-ui/react"; + ReactDOM.render( - + ,