HiddenHand.js (795B) [raw]
1 import React from 'react'; 2 import PropTypes from 'prop-types'; 3 4 class HiddenHand extends React.Component { 5 6 cardBacks = (num) => { 7 let cbacks = []; 8 for (let i = 0; i < num; i++){ 9 cbacks.push( 10 <div 11 key={i} 12 className="hid__card__div"> 13 <img className="hid__card" src="cards/1B.svg" /> 14 </div> 15 ); 16 } 17 return cbacks; 18 } 19 20 render () { 21 const { numCards } = this.props; 22 const cardBacks = this.cardBacks(numCards); 23 return ( 24 <div className="hid__card__row"> 25 {cardBacks} 26 </div> 27 ); 28 }; 29 } 30 HiddenHand.propTypes = { 31 numCards: PropTypes.number 32 } 33 export default HiddenHand;