@@ -3,13 +3,28 @@ import { useContext, useEffect, useMemo, useState } from "react";
33import Divider from "@material-ui/core/Divider" ;
44import Paper from "@material-ui/core/Paper" ;
55import Typography from "@material-ui/core/Typography" ;
6- import { animated , useTransition } from "@react-spring/web" ;
6+ import { makeStyles } from "@material-ui/core/styles" ;
7+ import { animated , to , useTransition } from "@react-spring/web" ;
78
89import ResponsiveSetCard from "../components/ResponsiveSetCard" ;
910import { SettingsContext } from "../context" ;
1011import useDimensions from "../hooks/useDimensions" ;
1112import useKeydown , { getModifierState } from "../hooks/useKeydown" ;
1213
14+ const useStyles = makeStyles ( {
15+ staticCard : {
16+ position : "absolute" ,
17+ } ,
18+ movingCard : {
19+ position : "absolute" ,
20+ pointerEvents : "none" ,
21+ zIndex : 1 ,
22+ "& > div" : {
23+ backgroundColor : "transparent !important" ,
24+ } ,
25+ } ,
26+ } ) ;
27+
1328const gamePadding = 8 ;
1429
1530function addLastSet ( board , lastSet ) {
@@ -36,6 +51,7 @@ function Game({
3651 showShortcuts,
3752 remaining = - 1 ,
3853} ) {
54+ const classes = useStyles ( ) ;
3955 const { keyboardLayout, layoutOrientation, cardOrientation } =
4056 useContext ( SettingsContext ) ;
4157 const isHorizontal = cardOrientation === "horizontal" ;
@@ -229,14 +245,12 @@ function Game({
229245 card && (
230246 < animated . div
231247 key = { card }
232- style = { {
233- position : "absolute" ,
234- zIndex : style . opacity . to ( ( x ) => ( x === 1 ? "auto" : 1 ) ) ,
235- pointerEvents : style . opacity . to ( ( x ) =>
236- x === 1 ? "auto" : "none"
237- ) ,
238- ...style ,
239- } }
248+ className = { to ( [ style . left , style . top ] , ( ) =>
249+ style . left . idle && style . top . idle
250+ ? classes . staticCard
251+ : classes . movingCard
252+ ) }
253+ style = { style }
240254 >
241255 { showShortcuts ? (
242256 < div
0 commit comments