summaryrefslogtreecommitdiff
path: root/frontend/src/components/gameList.js
blob: 0b4091a7544cdbbd9b8130e95fadab5cc5e261eb (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
// @flow
import type { List } from 'immutable';
import React from 'react';
import { Button, Space, Text } from 'rebass';
import { Flex } from 'reflexbox';
import type { Game } from '../models/games';

export const GameList = ({ games, joinGame }: { games: List<Game>, joinGame: (gameId: string) => void }) => (
  <div>
    {games.map((game: Game, index: number) => {
      return (
        <Flex key={game.get('displayName', index)}>
          <Text>{game.name}</Text>
          <Space auto />
          <Button onClick={() => joinGame(game.id)}>Join</Button>
        </Flex>
      );
    })}
  </div>
);
bgstack15