Skip to content

Commit

Permalink
Use dropdown compoment in host form
Browse files Browse the repository at this point in the history
  • Loading branch information
SmileyJames committed Jul 17, 2021
1 parent 7d51f55 commit 71c16c1
Showing 1 changed file with 4 additions and 8 deletions.
12 changes: 4 additions & 8 deletions app/src/components/host-form/HostForm.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { useState } from "react";
import { Box, Button } from "rebass/styled-components";
import { Label, Select } from "@rebass/forms/styled-components";
import Dropdown from "components/dropdown";

const HostForm = ({ compendium = [], onNewGame = () => {} }) => {
const [value, set] = useState(0);
Expand All @@ -12,15 +12,11 @@ const HostForm = ({ compendium = [], onNewGame = () => {} }) => {

const onSubmit = () => onNewGame(value);

const options = compendium.map(({ name }) => name);

return (
<Box minWidth="10em" px={2} my={4} width={['60%', '50%', '20em']}>
<Label fontFamily="body" my={2}>
Choose a game to host...
</Label>
<Select my={2} onChange={onChange} value={value}>
{compendium.map(({ name }, index) =>
<option value={index} key={index}>{name}</option>)}
</Select>
<Dropdown options={options} label="Choose a game to host..." onChange={onChange} value={value} />
<Button my={2} onClick={onSubmit} onKeyPress={onSubmit}>Host New Game</Button>
</Box>
)
Expand Down

0 comments on commit 71c16c1

Please sign in to comment.