import React, { useState, useCallback } from "react"; import "./ChooseCard.css"; import Paper from '@material-ui/core/Paper'; import Resource from './Resource.js'; const ChooseCard = ({table, type}) => { if (!table.game) { return <>; } const selectCard = (card) => { table.selectResource(card); } const resources = [ 'wheat', 'brick', 'stone', 'sheep', 'wood' ].map(type => { return selectCard(type)}/>; }); let title; switch (type) { case 'monopoly': title = <>Monopoly! Tap the resource type you want everyone to give you!; break; case 'year-of-plenty': title = <>Year of Plenty! Tap the resource type and receive 2 from the bank!; break; } return (
{ title }
{ resources }
); }; export default ChooseCard;