-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Started on css. Hands can display in acceptable way. Position for pla…
…yer hands on left and right is not ideal, but won't be fixing it.
- Loading branch information
dgoelitz
authored and
dgoelitz
committed
Oct 24, 2023
1 parent
d701017
commit 8407fcb
Showing
23 changed files
with
171 additions
and
86 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,38 +1,52 @@ | ||
.App { | ||
text-align: center; | ||
body { | ||
display: flex; | ||
flex-direction: column; | ||
width: 100%; | ||
height: 100vh; | ||
margin: 0; | ||
} | ||
|
||
.App-logo { | ||
height: 40vmin; | ||
pointer-events: none; | ||
.container { | ||
display: flex; | ||
justify-content: space-around; | ||
flex: 1; | ||
} | ||
|
||
@media (prefers-reduced-motion: no-preference) { | ||
.App-logo { | ||
animation: App-logo-spin infinite 20s linear; | ||
} | ||
.box { | ||
position: relative; | ||
width: 83%; | ||
height: 25vh; | ||
background-color: lightblue; | ||
border: 1px solid #000; | ||
} | ||
|
||
.App-header { | ||
background-color: #282c34; | ||
min-height: 100vh; | ||
display: flex; | ||
flex-direction: column; | ||
align-items: center; | ||
justify-content: center; | ||
font-size: calc(10px + 2vmin); | ||
color: white; | ||
.cool { | ||
background-color: red; | ||
} | ||
|
||
.App-link { | ||
color: #61dafb; | ||
.waycool { | ||
height: 50vh; | ||
} | ||
|
||
@keyframes App-logo-spin { | ||
from { | ||
transform: rotate(0deg); | ||
} | ||
to { | ||
transform: rotate(360deg); | ||
} | ||
.slick { | ||
width: 134%; | ||
} | ||
|
||
.hand0 { | ||
position: absolute; | ||
bottom: 0; | ||
} | ||
|
||
.hand1 { | ||
position: absolute; | ||
transform-origin: center right; | ||
bottom: 90%; | ||
right: 10%; | ||
} | ||
|
||
.hand3 { | ||
position: absolute; | ||
transform-origin: center left; | ||
bottom: 90%; | ||
left: 10%; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
import Hand from './Hand'; | ||
|
||
function Game() { | ||
|
||
const hands = [ | ||
['h3','w2','b4','h1','h1','h1','h1'], | ||
['b','b','h','w','w','h','h'], | ||
['b','b','h','w','w','h','h'], | ||
['b','b','h','w','w','h','h']] | ||
|
||
return ( | ||
<div className="Game"> | ||
<div className="container"> | ||
<div className="box cool"></div> | ||
<div className="box slick"> | ||
<Hand handClass="hand2" hand={hands[2]} rotation={180}></Hand> | ||
</div> | ||
<div className="box cool"></div> | ||
</div> | ||
<div className="container"> | ||
<div className="box waycool"> | ||
<Hand handClass="hand3" hand={hands[3]} rotation={90}></Hand> | ||
</div> | ||
<div className="box cool waycool slick"></div> | ||
<div className="box waycool"> | ||
<Hand handClass="hand1" hand={hands[1]} rotation={270}></Hand> | ||
</div> | ||
</div> | ||
<div className="container"> | ||
<div className="box cool"></div> | ||
<div className="box slick"> | ||
<Hand handClass="hand0" hand={hands[0]} rotation={0}></Hand> | ||
</div> | ||
<div className="box cool"></div> | ||
</div> | ||
</div> | ||
); | ||
} | ||
|
||
export default Game; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
import React, { useState, useEffect, useMemo } from 'react'; | ||
|
||
function Hand(props) { | ||
const cardNames = useMemo(() => [ | ||
'w', 'w1', 'w2', 'w3', | ||
'h', 'h1', 'h2', 'h3', | ||
'b', 'b4', 'b5', 'b6', 'b7', 'b8', 'b9', 'b12' | ||
], []); | ||
|
||
const [cards, setCards] = useState({}); | ||
|
||
useEffect(() => { | ||
const importCards = async () => { | ||
const cardImports = cardNames.map(cardName => import(`./images/cards/${cardName}.png`)); | ||
const cardModules = await Promise.all(cardImports); | ||
const cardMap = {}; | ||
cardNames.forEach((cardName, index) => { | ||
cardMap[cardName] = cardModules[index].default; | ||
}); | ||
setCards(cardMap); | ||
}; | ||
|
||
importCards(); | ||
}, [cardNames]); | ||
|
||
const hand = props.hand.map((cardName, index) => { | ||
const card = cards[cardName]; | ||
return <img key={index} src={card} alt={`A ${card} card`} style={{ width: 100 / props.hand.length + "%" }} />; | ||
}); | ||
|
||
return ( | ||
<div className={props.handClass} style={{ transform: `rotate(${props.rotation}deg)` }}> | ||
{hand} | ||
</div> | ||
); | ||
} | ||
|
||
export default Hand; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.