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

const GameList = props => (
  <div>
    {Immutable.asMutable(props.games).map((game, index) => {
      const joinGame = () => props.joinGame(game.id);

      return (
        <Flex key={index}>
          <Text>{game.name}</Text>
          <Space auto />
          <Button onClick={joinGame}>Join</Button>
        </Flex>
      );
    })}
  </div>
);

export default GameList;
bgstack15