Skip to content

Commit

Permalink
Transition from Welcome to Setup
Browse files Browse the repository at this point in the history
  • Loading branch information
albin-karlsson committed Mar 21, 2024
1 parent 3315404 commit 7a5ed65
Show file tree
Hide file tree
Showing 5 changed files with 34 additions and 8 deletions.
2 changes: 1 addition & 1 deletion client/src/App.css
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ html,
}

.sub-header {
font-size: 40px;
font-size: 52px;
margin: 8px;
font-weight: normal;
}
Expand Down
19 changes: 17 additions & 2 deletions client/src/App.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,13 @@
import "./App.css";
import React, { useState } from "react";
import Overlay from "./components/Overlay";
import Welcome from "./components/Welcome";
import Setup from "./components/Setup";
import backgroundImage from "./images/council-of-foods-background.jpg";

function App() {
const [currentView, setCurrentView] = useState("welcome"); // "welcome" or "setup"

const backgroundStyle = {
backgroundImage: `url(${backgroundImage})`,
backgroundSize: "cover",
Expand All @@ -12,10 +16,21 @@ function App() {
width: "100vw",
};

const enterSetup = () => {
setCurrentView("setup");
};

return (
<div className="App" style={backgroundStyle}>
<div
className="App"
style={backgroundStyle}
>
<Overlay>
<Welcome />
{currentView === "welcome" ? (
<Welcome onEnterSetup={enterSetup} />
) : (
<Setup />
)}
</Overlay>
</div>
);
Expand Down
5 changes: 2 additions & 3 deletions client/src/components/NameInput.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import React, { useState } from "react";
import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";
import { faArrowRight } from "@fortawesome/free-solid-svg-icons";

function NameInput() {
function NameInput(props) {
const [name, setName] = useState("");
const [isNameMissing, setIsNameMissing] = useState(false);

Expand All @@ -22,8 +22,7 @@ function NameInput() {

function enterCouncil() {
if (name) {
console.log("Entering council...");
setIsNameMissing(false);
props.onEnterSetup();
} else {
console.log("No name...");
setIsNameMissing(true);
Expand Down
12 changes: 12 additions & 0 deletions client/src/components/Setup.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
import React from "react";

function Setup() {
return (
<div>
<h2>Setup Component</h2>
{/* Setup content goes here */}
</div>
);
}

export default Setup;
4 changes: 2 additions & 2 deletions client/src/components/Welcome.jsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import React from "react";
import NameInput from "./NameInput";

function Welcome() {
function Welcome({ onEnterSetup }) {
const welcomeStyle = {
zIndex: 10,
color: "white",
Expand All @@ -20,7 +20,7 @@ function Welcome() {
<h2 className="sub-header">welcome to</h2>
<h1 className="header">COUNCIL OF FOODS</h1>
</div>
<NameInput />
<NameInput onEnterSetup={onEnterSetup} />
</div>
);
}
Expand Down

0 comments on commit 7a5ed65

Please sign in to comment.