tome-web/client/pages/AppPage.tsx

34 lines
702 B
TypeScript
Raw Normal View History

2021-09-23 22:37:47 -04:00
import React from 'react'
import assertNever from '~/common/assertNever.ts'
2021-09-23 23:34:33 -04:00
import IntroPage from '../components/IntroPage.tsx'
import Page from '../components/Page.tsx'
import Game from '../game/Game.tsx'
type MenuState = 'menu' | 'play'
2021-09-23 22:37:47 -04:00
export default function AppPage() {
const [menuState, setMenuState] = React.useState<MenuState>('menu')
switch (menuState) {
case 'menu': {
return (
<IntroPage>
<button onClick={() => setMenuState('play')}>
Play
</button>
</IntroPage>
)
}
case 'play': {
return (
<Page>
<Game />
</Page>
)
}
default: return assertNever(menuState)
}
2021-09-23 22:37:47 -04:00
}