-
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #43 from skedwards88/extended-menu
Move buttons to extended menu
- Loading branch information
Showing
19 changed files
with
366 additions
and
133 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
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
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
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,24 @@ | ||
import React from "react"; | ||
|
||
export default function CustomError({ | ||
invalidReason, | ||
dispatchCustomState, | ||
setDisplay, | ||
}) { | ||
return ( | ||
<div className="App customMessage"> | ||
<div>{`Your custom crossjig isn't ready to play yet: \n\n${invalidReason}`}</div> | ||
<button | ||
onClick={() => { | ||
dispatchCustomState({ | ||
action: "updateInvalidReason", | ||
invalidReason: "", | ||
}); | ||
setDisplay("custom"); | ||
}} | ||
> | ||
Ok | ||
</button> | ||
</div> | ||
); | ||
} |
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,80 @@ | ||
import React from "react"; | ||
import packageJson from "../../package.json"; | ||
import {handleShare} from "../common/handleShare"; | ||
import {handleInstall} from "../common/handleInstall"; | ||
|
||
export default function ExtendedMenu({ | ||
setDisplay, | ||
setInstallPromptEvent, | ||
showInstallButton, | ||
installPromptEvent, | ||
}) { | ||
return ( | ||
<div className="App" id="extendedMenu"> | ||
<h1>Crossjig</h1> | ||
<button onClick={() => setDisplay("rules")}> | ||
<div id="rulesIcon" className="extendedMenuIcon"></div> | ||
<span>How to play</span> | ||
</button> | ||
|
||
<button onClick={() => setDisplay("custom")}> | ||
<div id="customIcon" className="extendedMenuIcon"></div> | ||
<span>Create a custom crossjig</span> | ||
</button> | ||
|
||
<button onClick={() => setDisplay("settings")}> | ||
<div id="settingsIcon" className="extendedMenuIcon"></div> | ||
<span>Settings</span> | ||
</button> | ||
|
||
{navigator.canShare ? ( | ||
<button | ||
onClick={() => | ||
handleShare({ | ||
appName: "Crossjig", | ||
text: "Check out this word game!", | ||
url: "https://crossjig.com", | ||
}) | ||
} | ||
> | ||
<div id="shareIcon" className="extendedMenuIcon"></div> | ||
<span>Share</span> | ||
</button> | ||
) : ( | ||
<></> | ||
)} | ||
|
||
{showInstallButton && installPromptEvent ? ( | ||
<button | ||
onClick={() => | ||
handleInstall(installPromptEvent, setInstallPromptEvent) | ||
} | ||
> | ||
<div id="installIcon" className="extendedMenuIcon"></div> | ||
<span>{"Install (offline play and easy access)"}</span> | ||
</button> | ||
) : ( | ||
<button onClick={() => setDisplay("fallbackInstall")}> | ||
<div id="installIcon" className="extendedMenuIcon"></div> | ||
<span>{"Install (play offline)"}</span> | ||
</button> | ||
)} | ||
|
||
<button onClick={() => setDisplay("moreGames")}> | ||
<div id="heartIcon" className="extendedMenuIcon"></div> | ||
<span>More games like this</span> | ||
</button> | ||
|
||
<button onClick={() => setDisplay("heart")}> | ||
<div id="infoIcon" className="extendedMenuIcon"></div> | ||
<span>Info and feedback</span> | ||
</button> | ||
|
||
<button onClick={() => setDisplay("game")}> | ||
<div id="backIcon" className="extendedMenuIcon"></div> | ||
<span>Return to game</span> | ||
</button> | ||
<small id="version">version {packageJson.version}</small> | ||
</div> | ||
); | ||
} |
Oops, something went wrong.