mau + themecontext that will soothe my eyes soon

This commit is contained in:
2023-03-22 16:01:54 +01:00
parent a7622c26ef
commit 157c5e8ffa
7 changed files with 56 additions and 18 deletions

View File

@@ -1,5 +1,5 @@
import React from "react"; import React from "react";
import useTitle from "../../utils/TitleHook"; import useTitle from "../../utils/hooks/TitleHook";
import Card from "../components/Card"; import Card from "../components/Card";
const ROOM_URL = `http://${process.env.REACT_APP_API_URL}/room`; const ROOM_URL = `http://${process.env.REACT_APP_API_URL}/room`;
@@ -22,15 +22,18 @@ const MainLobby = () => {
return ( return (
<div className={"main-lobby"}> <div className={"main-lobby"}>
<div className={"main-lobby__button clickable"} onClick={handleCreateRoom}> <h1 className={"main-lobby__title mau"}>MauMau</h1>
<h2>Host Game</h2> <div className={"main-lobby__container"}>
<div className={"main-lobby__container-button clickable"} onClick={handleCreateRoom}>
<h2 className={"mau"}>Host Game</h2>
<Card cardString={'SPADES ACE'} isClickable /> <Card cardString={'SPADES ACE'} isClickable />
</div> </div>
<div className={"main-lobby__button clickable"} onClick={gotoRooms}> <div className={"main-lobby__container-button clickable"} onClick={gotoRooms}>
<h2>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>
); );
} }

View File

@@ -2,7 +2,7 @@ import useWebSocket from "react-use-websocket";
import React from "react"; import React from "react";
import {useParams} from "react-router"; import {useParams} from "react-router";
import {GHButton} from "../components/Button"; import {GHButton} from "../components/Button";
import useTitle from "../../utils/TitleHook"; import useTitle from "../../utils/hooks/TitleHook";
import Hand from "../components/Hand"; import Hand from "../components/Hand";
import Deck from "../components/Deck"; import Deck from "../components/Deck";

View File

@@ -1,4 +1,4 @@
import useTitle from "../../utils/TitleHook"; import useTitle from "../../utils/hooks/TitleHook";
import React from "react"; import React from "react";
import {Link} from "react-router-dom"; import {Link} from "react-router-dom";

View File

@@ -7,6 +7,6 @@
src: local('Mau'), url(../assets/fonts/OrientalCatsLight.otf) format('opentype'); src: local('Mau'), url(../assets/fonts/OrientalCatsLight.otf) format('opentype');
} }
h1, h2, h3, h4, h5 { .mau {
font-family: "Mau", serif; font-family: "Mau", serif;
} }

View File

@@ -1,15 +1,24 @@
.main-lobby { .main-lobby {
width: 100vw; width: 100vw;
height: 100vh; height: 75vh;
display: flex; display: flex;
justify-content: center; flex-direction: column;
justify-content: space-evenly;
align-items: center; align-items: center;
&__container {
display: flex;
gap: 2rem; gap: 2rem;
&__button { &-button {
display: flex; display: flex;
flex-direction: column; flex-direction: column;
justify-content: center; justify-content: center;
align-items: center; align-items: center;
} }
}
&__title {
font-size: 5rem;
}
} }

View File

@@ -0,0 +1,26 @@
import React from "react";
interface IThemeContext {
isDarkMode: boolean
toggleTheme?: () => void
}
const ThemeContext = React.createContext<IThemeContext>({
isDarkMode: true
});
export const useTheme = () => React.useContext(ThemeContext);
const ThemeContextProvider = ({children}: any) => {
const [isDarkMode, setIsDarkMode] = React.useState(true);
const toggleTheme = () => {
setIsDarkMode(!isDarkMode);
};
return (
<ThemeContext.Provider value={{isDarkMode, toggleTheme}}>
{children}
</ThemeContext.Provider>
);
};