Skip to content

Commit

Permalink
center popups (#124)
Browse files Browse the repository at this point in the history
  • Loading branch information
danbastin authored Feb 24, 2025
1 parent 21a6c0d commit e639748
Showing 1 changed file with 25 additions and 25 deletions.
50 changes: 25 additions & 25 deletions src/app/_components/_sharedcomponents/Popup/Popup.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ const overlayStyle = {
width: '100%',
height: '100%',
pointerEvents: 'none',
backgroundColor: 'rgba(0, 0, 0, 0.3)',
display: 'flex',
zIndex: 10,
};
Expand All @@ -30,36 +29,37 @@ const focusHandlerStyle = (type: PopupType, data: PopupData, index: number, play
});

export const getPopupPosition = (type: PopupType, data: PopupData, index: number, playerName:string, containCards?:boolean) => {
const basePosition = {
return {
position: 'absolute',
left:'50%',
marginTop: '150px',
transform: `translate(0px, ${index * 50}px)`,
top: '50%',
transform: 'translate(-50%, -50%)',
width: '80%'
};

const pilePosition = {
position: 'absolute',
left: containCards ? '-23%' : '-30.5%',
width: '100%',
}
// const pilePosition = {
// position: 'absolute',
// left: containCards ? '-23%' : '-30.5%',
// width: '100%',
// }

if (type === 'pile') {
if (data.uuid === `${playerName}-discard`) {
return {
...pilePosition,
bottom: '400px',
} as const;
}
return {
...pilePosition,
top: '350px',
} as const;
}
// if (type === 'pile') {
// if (data.uuid === `${playerName}-discard`) {
// return {
// ...pilePosition,
// bottom: '400px',
// } as const;
// }
// return {
// ...pilePosition,
// top: '350px',
// } as const;
// }

return {
...basePosition,
top: '150px',
} as const;
// return {
// ...basePosition,
// top: '150px',
// } as const;
}

const PopupShell: React.FC = () => {
Expand Down

0 comments on commit e639748

Please sign in to comment.