import React, {FunctionComponent} from 'react';
import Card from "./Card";

interface Props {
    hand: string[];
    actionOnClick: (cardString: string) => void;
    isHidden?: boolean;
}

const Hand: FunctionComponent<Props> = ({hand, actionOnClick, isHidden}) => {

    const isMyHand = !isHidden;

    return (
        <div className="hand">
            {
                hand.map((card, index) => {
                    return (
                        <Card key={index} cardString={card} handleClick={actionOnClick} isHidden={!isMyHand}
                              isClickable={isMyHand}/>
                    )
                })
            }
        </div>
    )
}

export default Hand;
