-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Working landing page and fight screen load button
Relates #2 #8 Co-authored-by: shaya <[email protected]>
- Loading branch information
Showing
4 changed files
with
43 additions
and
22 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,33 +1,19 @@ | ||
import React from "react"; | ||
import "./App.css"; | ||
import FishCard from "./modules/fish-card"; | ||
import { getRandomFishData } from "./modules/fetch-helper"; | ||
import LandingPage from "./modules/landing-page"; | ||
import FightPage from "./modules/fight-page"; | ||
|
||
function App() { | ||
const [fishData, setFishData] = React.useState(null); | ||
// opponentFish data | ||
|
||
// button activated effect - rejects button | ||
React.useEffect(() => { | ||
getRandomFishData().then((data) => { | ||
setFishData(data); | ||
}); | ||
}, []); | ||
const [page, setPage] = React.useState(true); | ||
|
||
return ( | ||
// return landing page on first load - logo and randomizer button | ||
<div className="App"> | ||
<header className="App-header"></header> | ||
{/* title - some kind of fish pun */} | ||
<body className="App-body"> | ||
<LandingPage /> | ||
{/* <FishCard {...fishData} /> */} | ||
{/* accept or reject buttons */} | ||
{page ? <LandingPage setPage={setPage} /> : <FightPage />} | ||
</body> | ||
</div> | ||
); | ||
} | ||
//landing page function | ||
//fight page function | ||
|
||
export default App; |
File renamed without changes
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
import React from "react"; | ||
import FishCard from "./fish-card"; | ||
import { getRandomFishData } from "./fetch-helper"; | ||
|
||
const FightPage = () => { | ||
const [fishData, setFishData] = React.useState(null); | ||
const [opponentFishData, setOpponentFishData] = React.useState(null); | ||
|
||
// button activated effect - rejects button | ||
React.useEffect(() => { | ||
getRandomFishData().then((data) => { | ||
setFishData(data); | ||
}); | ||
}, []); | ||
return ( | ||
<> | ||
<h1>Being weighed in the scales</h1> | ||
<FishCard {...fishData} /> | ||
<button>I'm hooked - Accept</button> | ||
<button | ||
onClick={() => { | ||
getRandomFishData().then((data) => { | ||
setFishData(data); | ||
}); | ||
}} | ||
> | ||
A load of pollocks! - Choose again. | ||
</button> | ||
</> | ||
); | ||
}; | ||
|
||
export default FightPage; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters