Skip to content

Commit

Permalink
fix(card-stack): use max card on stack to avoid layout bugs
Browse files Browse the repository at this point in the history
  • Loading branch information
guilhermebkel authored Apr 2, 2024
1 parent d3acb48 commit 1c14385
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions packages/unoenty/src/pages/Table/CardStack/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@ type CardStackProps = {

let lastAmountToBuy = 0

const MAX_CARDS_VISIBLE_ON_CARD_STACK = 20

const CardStack: React.FC<CardStackProps> = (props) => {
const cardStore = useCardStore()
const socket = useSocket()
Expand Down Expand Up @@ -132,15 +134,15 @@ const CardStack: React.FC<CardStackProps> = (props) => {
container
className={classes.cardStackContent}
>
{cards?.slice(0, 20)?.map((card, index) => (
{cards?.slice(0, MAX_CARDS_VISIBLE_ON_CARD_STACK)?.map((card, index) => (
<img
key={card.id}
className={classes.card}
alt={card.name}
src={card.src}
style={{
transform: `rotate(${cards.length - index}rad)`,
zIndex: cards.length - index,
transform: `rotate(${MAX_CARDS_VISIBLE_ON_CARD_STACK - index}rad)`,
zIndex: MAX_CARDS_VISIBLE_ON_CARD_STACK - index,
filter: (index === 0) ? "saturate(1.5)" : "contrast(0.5)",
}}
/>
Expand Down

0 comments on commit 1c14385

Please sign in to comment.