dark hihi

This commit is contained in:
2023-03-22 16:18:31 +01:00
parent 157c5e8ffa
commit 34acfc65c3
7 changed files with 34 additions and 8 deletions

View File

@@ -1,11 +1,17 @@
import React from 'react'; import React from 'react';
import '../src/styles/App.scss'; import '../src/styles/App.scss';
import Router from "./config/Router"; import Router from "./config/Router";
import ThemeContextProvider, {useTheme} from "./utils/contexts/ThemeContext";
function App() { function App() {
return (
<Router/> const {isDarkMode} = useTheme();
);
return (
<div className={`app ${isDarkMode ? 'dark' : 'light'}`}>
<Router/>
</div>
);
} }
export default App; export default App;

View File

@@ -1,12 +1,15 @@
import React from 'react'; import React from 'react';
import ReactDOM from 'react-dom/client'; import ReactDOM from 'react-dom/client';
import App from './App'; import App from './App';
import ThemeContextProvider from "./utils/contexts/ThemeContext";
const root = ReactDOM.createRoot( const root = ReactDOM.createRoot(
document.getElementById('root') as HTMLElement document.getElementById('root') as HTMLElement
); );
root.render( root.render(
<React.StrictMode> <React.StrictMode>
<App /> <ThemeContextProvider>
<App />
</ThemeContextProvider>
</React.StrictMode> </React.StrictMode>
); );

View File

@@ -1,6 +1,7 @@
import React from "react"; import React from "react";
import useTitle from "../../utils/hooks/TitleHook"; import useTitle from "../../utils/hooks/TitleHook";
import Card from "../components/Card"; import Card from "../components/Card";
import {useTheme} from "../../utils/contexts/ThemeContext";
const ROOM_URL = `http://${process.env.REACT_APP_API_URL}/room`; const ROOM_URL = `http://${process.env.REACT_APP_API_URL}/room`;
@@ -26,11 +27,11 @@ const MainLobby = () => {
<div className={"main-lobby__container"}> <div className={"main-lobby__container"}>
<div className={"main-lobby__container-button clickable"} onClick={handleCreateRoom}> <div className={"main-lobby__container-button clickable"} onClick={handleCreateRoom}>
<h2 className={"mau"}>Host Game</h2> <h2 className={"mau"}>Host Game</h2>
<Card cardString={'SPADES ACE'} isClickable /> <Card cardString={'SPADES ACE'} isClickable/>
</div> </div>
<div className={"main-lobby__container-button clickable"} onClick={gotoRooms}> <div className={"main-lobby__container-button clickable"} onClick={gotoRooms}>
<h2 className={"mau"}>Join Game</h2> <h2 className={"mau"}>Join Game</h2>
<Card cardString={'SPADES ACE'} isHidden isClickable /> <Card cardString={'SPADES ACE'} isHidden isClickable/>
</div> </div>
</div> </div>
</div> </div>

View File

@@ -7,6 +7,11 @@
src: local('Mau'), url(../assets/fonts/OrientalCatsLight.otf) format('opentype'); src: local('Mau'), url(../assets/fonts/OrientalCatsLight.otf) format('opentype');
} }
.app {
width: 100vw;
height: 100vh;
}
.mau { .mau {
font-family: "Mau", serif; font-family: "Mau", serif;
} }

View File

@@ -1 +1,2 @@
@import "pointer"; @import "pointer";
@import "theme";

View File

@@ -0,0 +1,8 @@
.dark {
background-color: #333;
color: #fff;
}
.light {
background-color: #fff;
color: #333;
}

View File

@@ -24,3 +24,5 @@ const ThemeContextProvider = ({children}: any) => {
</ThemeContext.Provider> </ThemeContext.Provider>
); );
}; };
export default ThemeContextProvider;