summaryrefslogtreecommitdiff
path: root/frontend/src/components/gameList.js
blob: e1d011e1ebaaa58de9be78be152a182cc2ec65c9 (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