Skip to content

Commit

Permalink
Fix continue button on splash screen
Browse files Browse the repository at this point in the history
Was missing the right scope.
  • Loading branch information
oskarrough committed Jan 23, 2024
1 parent cd0b76c commit c9aa942
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 17 deletions.
18 changes: 12 additions & 6 deletions src/ui/components/slay-the-web.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,9 @@ export default class SlayTheWeb extends Component {
const initialGameMode = urlParams.has('debug') ? GameModes.gameplay : GameModes.splash
this.state = {gameMode: initialGameMode}

this.handleWin = this.handleWin.bind(this)
this.handleNewGame = this.handleNewGame.bind(this)
this.handleContinue = this.handleContinue.bind(this)
this.handleWin = this.handleWin.bind(this)
this.handleLoose = this.handleLoose.bind(this)
}

Expand All @@ -47,12 +48,17 @@ export default class SlayTheWeb extends Component {
this.setState({gameMode: GameModes.splash})
}

render(props, {gameMode}) {
if (gameMode === GameModes.splash)
render() {
const {gameMode} = this.state
if (gameMode === GameModes.splash) {
return html`<${SplashScreen} onNewGame=${this.handleNewGame} onContinue=${this.handleContinue} />`
if (gameMode === GameModes.gameplay)
return html` <${GameScreen} onWin=${this.handleWin} onLoose=${this.handleLoose} /> `
if (gameMode === GameModes.win) return html` <${WinScreen} onNewGame=${this.handleNewGame} /> `
}
if (gameMode === GameModes.gameplay) {
return html`<${GameScreen} onWin=${this.handleWin} onLoose=${this.handleLoose} /> `
}
if (gameMode === GameModes.win) {
return html`<${WinScreen} onNewGame=${this.handleNewGame} /> `
}
}
}

Expand Down
4 changes: 2 additions & 2 deletions src/ui/components/splash-screen.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@ export default class SplashScreen extends Component {
<ul class="Options">
${location.hash
? html`
<li><button autofocus onClick=${props.onContinue}>Continue Game</button></li>
<li><button autofocus onClick=${props.onNewGame}>New Game</a></li>
<li>Found a saved game. <button autofocus onClick=${props.onContinue}>Continue?</button></li>
<li><button onClick=${props.onNewGame}>New Game</a></li>
`
: html`
<li><button autofocus onClick=${props.onNewGame}>Play</a></li>
Expand Down
9 changes: 0 additions & 9 deletions src/ui/styles/app.css
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,6 @@ html {
cursor: url(/images/cursors/default.png), auto;
min-height: 100%;
background-color: var(--bg);
/* background-image: url('/images/scenes/dalle5.webp'); */
/* background-position: center bottom; */
background-attachment: fixed;
background-position: 50%;
background-size: cover;
Expand All @@ -33,13 +31,6 @@ input,

body {
margin: 0;
/* overflow: hidden; */
/* overflow-x: hidden; */
/* overflow-y: scroll; */
}

[inverse] {
color: var(--text-inverse);
}

[center] {
Expand Down

1 comment on commit c9aa942

@vercel
Copy link

@vercel vercel bot commented on c9aa942 Jan 23, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Successfully deployed to the following URLs:

slaytheweb – ./

slaytheweb-oskar.vercel.app
slaytheweb.vercel.app
slaytheweb-git-main-oskar.vercel.app
slaytheweb.cards

Please sign in to comment.