Skip to content

Commit 0e5e691

Browse files
committed
LevelComponent centered
1 parent 14262ef commit 0e5e691

2 files changed

Lines changed: 13 additions & 15 deletions

File tree

src/components/LevelComponent.tsx

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,9 @@ export default function LevelComponent({ onClose, lvl }: LevelProps) {
1515
const handleAnimationEnd = () => {
1616
if (isClosing) onClose();
1717
};
18-
const seed = lvl*71 - 10;
18+
const seed = lvl * 71 - 10;
1919
return (
20-
<div className="flex items-center justify-center min-h-screen w-full container">
20+
<div className="flex items-center justify-center h-full w-full">
2121
<style>{`
2222
@keyframes expandDown {
2323
from { transform: scaleY(0); }
@@ -35,14 +35,10 @@ export default function LevelComponent({ onClose, lvl }: LevelProps) {
3535
animation: collapseUp 0.2s ease-in forwards;
3636
transform-origin: center;
3737
}
38-
.container {
39-
position: absolute;
40-
z-index: 1000;
41-
margin: 0px;
42-
}
38+
4339
`}</style>
4440
<div
45-
className={`${isClosing ? 'collapse-up' : 'expand-down'} w-4/5 h-screen flex gap-10 p-4 font-mono overflow-hidden`}
41+
className={`${isClosing ? 'collapse-up' : 'expand-down'} w-full h-full flex gap-10 p-4 font-mono overflow-hidden`}
4642
onAnimationEnd={handleAnimationEnd}
4743
>
4844
{/* X button */}
@@ -53,7 +49,7 @@ export default function LevelComponent({ onClose, lvl }: LevelProps) {
5349
5450
</button>
5551

56-
<InfoComponent seed={seed}/>
52+
<InfoComponent seed={seed} />
5753
<OutputComponent seed={seed} />
5854
</div>
5955
</div>

src/pages/home/Home.tsx

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -32,13 +32,15 @@ export default function Home() {
3232
<button className="ml-5 mt-5 absolute border-4 rounded-3xl p-5" onClick={handleOpen} disabled={isVisible}>
3333
Glorp
3434
</button>
35-
<section className="">
35+
<section className="relative w-full h-screen">
3636
{isVisible && (
37-
<LevelComponent
38-
key={mountKey}
39-
onClose={() => setIsVisible(false)}
40-
lvl={lvlNum}
41-
/>
37+
<div className="absolute top-1/2 left-1/2 transform -translate-x-1/2 -translate-y-1/2 w-[90vw] h-[90vh] z-50">
38+
<LevelComponent
39+
key={mountKey}
40+
onClose={() => setIsVisible(false)}
41+
lvl={lvlNum}
42+
/>
43+
</div>
4244
)}
4345
<canvas ref={canvasRef} className={styles.solarsystem}></canvas>
4446
</section>

0 commit comments

Comments
 (0)