chs/src-web/components/Welcome.tsx

35 lines
752 B
TypeScript

import { Component } from "solid-js";
import Button, { ButtonContainer } from "./Button";
interface Props {
gameId: string;
joinGame: () => void;
}
const Welcome: Component<Props> = (props) => {
function shareInvite() {
navigator.share({
url: window.location.href,
});
}
return <>
<h1>Welcome</h1>
<section>
<h2>Game ID:</h2>
<pre>{props.gameId}</pre>
</section>
<ButtonContainer>
<Button onClick={() => shareInvite()}>
Share invite
</Button>
<Button onClick={() => props.joinGame()}>
Join
</Button>
</ButtonContainer>
</>;
}
export default Welcome;