source: components/blackjack/Cards.jsx@ b4369c8

main
Last change on this file since b4369c8 was 64dc53b, checked in by anastasovv <simon@…>, 2 years ago

Code cleanings

  • Property mode set to 100644
File size: 843 bytes
Line 
1import React from 'react'
2
3import { useSelector } from 'react-redux'
4
5import Card from '../Card'
6
7const Cards = () => {
8 const playerState = useSelector(state => state.player)
9
10 let playerPos = {
11 left: 50,
12 top: 75.5
13 }
14
15 let dealerPos = {
16 left: 50,
17 top: 32,
18 }
19
20 const splitCardsMultiplyByInt = 2;
21
22 return (
23 <div className="blackjackCards">
24 {playerState?.game?.playerCards?.map((card, i) => (
25 <Card key={card} card={card} rotateZ={i*splitCardsMultiplyByInt} pos={{left: playerPos.left+i*splitCardsMultiplyByInt, top: playerPos.top}}/>
26 ))}
27 {playerState?.game?.dealerCards?.map((card, i) => (
28 <Card key={card} card={card} rotateZ={i*splitCardsMultiplyByInt} pos={{left: dealerPos.left+i*splitCardsMultiplyByInt, top: dealerPos.top}}/>
29 ))}
30 </div>
31 )
32}
33
34export default Cards
Note: See TracBrowser for help on using the repository browser.