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

import type { List } from 'immutable';
import type { Game } from '../models/games';

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>
);

export default GameList;
bgstack15