diff options
author | lonkaars <l.leblansch@gmail.com> | 2021-03-08 15:43:25 +0100 |
---|---|---|
committer | lonkaars <l.leblansch@gmail.com> | 2021-03-08 15:43:25 +0100 |
commit | 2ab7cfe761b47eed848becbc9386f6a94ef44d3d (patch) | |
tree | 5b53e6b20069d74a3250d861533c73dc4a8cefac /components | |
parent | b56d17983facdbe29f397c08b7b14ac3ff783a88 (diff) |
game/resign thingy
Diffstat (limited to 'components')
-rw-r--r-- | components/gameBar.tsx | 15 | ||||
-rw-r--r-- | components/ui.tsx | 8 |
2 files changed, 15 insertions, 8 deletions
diff --git a/components/gameBar.tsx b/components/gameBar.tsx index 439caea..cacb5e8 100644 --- a/components/gameBar.tsx +++ b/components/gameBar.tsx @@ -6,18 +6,18 @@ import ExitToAppRoundedIcon from '@material-ui/icons/ExitToAppRounded'; import NavigateNextRoundedIcon from '@material-ui/icons/NavigateNextRounded'; import NavigateBeforeRoundedIcon from '@material-ui/icons/NavigateBeforeRounded'; -interface GameBarModuleProps { +function GameBarModule(props: { children?: ReactNode; -} - -function GameBarModule(props: GameBarModuleProps) { + onclick?: () => void; +}) { return <Vierkant style={{ backgroundColor: "var(--background-alt)", padding: 12, borderRadius: 6, margin: 0, - verticalAlign: "top" - }}>{props.children}</Vierkant> + verticalAlign: "top", + cursor: props.onclick ? "pointer" : "default" + }} onclick={props.onclick}>{props.children}</Vierkant> } var GameBarSpacer = () => <div style={{ width: 8, display: "inline-block" }}></div>; @@ -30,6 +30,7 @@ export function GameBar(props: { turn: boolean; player1: boolean; active: boolean; + resignFunction: () => void; }) { return <Vierkant className="gameBar" style={{ padding: 8, @@ -79,7 +80,7 @@ export function GameBar(props: { }}>00:00</span> </GameBarModule> <GameBarSpacer/> - <GameBarModule> + <GameBarModule onclick={props.resignFunction}> <ExitToAppRoundedIcon/> </GameBarModule> <GameBarSpacer/> diff --git a/components/ui.tsx b/components/ui.tsx index e6fdceb..e395a47 100644 --- a/components/ui.tsx +++ b/components/ui.tsx @@ -14,6 +14,7 @@ export function Vierkant(props: { className?: string; id?: string; fullwidth?: boolean; + onclick?: () => void; }) { return <a style={{ padding: 24, @@ -30,7 +31,12 @@ export function Vierkant(props: { undefined, height: props.height ? props.height : undefined, ...props.style - }} href={props.href} className={props.className} id={props.id}>{props.children}</a> + }} + href={props.href} + className={props.className} + id={props.id} + onClick={props.onclick} + >{props.children}</a> } export function Button(props: { |