fix weird overlay

This commit is contained in:
2025-11-07 01:47:18 -05:00
parent 7c53bc9d43
commit d33fce46b1
3 changed files with 33 additions and 31 deletions
+2 -2
View File
@@ -10,9 +10,9 @@ export default function Overlay({
return ( return (
<div <div
onClick={onClose} onClick={onClose}
className="absolute bg-black/50 min-h-screen w-full z-1 overflow-hidden flex justify-center items-center" className="absolute bg-black/50 w-full h-full z-1 overflow-hidden flex justify-center items-center"
> >
<div className="max-w-fit max-h-fit">{children}</div> {children}
</div> </div>
); );
} }
+6 -20
View File
@@ -1,5 +1,3 @@
import { useState } from "react";
import Overlay from "../Overlay";
import Picture from "../Picture"; import Picture from "../Picture";
const images = [ const images = [
@@ -10,34 +8,22 @@ const images = [
"https://storage.alexav.gg/content/2f36c1dd-eaf8-4fd3-a3cd-1d25fe8f5a07.jpg", "https://storage.alexav.gg/content/2f36c1dd-eaf8-4fd3-a3cd-1d25fe8f5a07.jpg",
]; ];
export default function PictureCarousel() { export default function PictureCarousel({
const [selectedImage, setSelectedImage] = useState<string>(""); onClick,
}: {
onClick: (url: string) => void;
}) {
return ( return (
<>
{selectedImage !== "" && (
<Overlay onClose={() => setSelectedImage("")}>
<img width="400" height="400" src={selectedImage} />
</Overlay>
)}
<div className="border border-white border-solid rounded-lg p-2"> <div className="border border-white border-solid rounded-lg p-2">
<h1 className="text-2xl font-bold italic">pictures</h1> <h1 className="text-2xl font-bold italic">pictures</h1>
<div className="whitespace-nowrap overflow-x-auto"> <div className="whitespace-nowrap overflow-x-auto">
<div className="my-2 space-x-2"> <div className="my-2 space-x-2">
{images.map((v, k) => { {images.map((v, k) => {
return ( return <Picture key={k} image={v} onClick={() => onClick(v)} />;
<Picture
key={k}
image={v}
onClick={() => setSelectedImage(v)}
/>
);
})} })}
</div> </div>
</div> </div>
</div> </div>
</>
); );
} }
+18 -2
View File
@@ -1,4 +1,6 @@
import { useState } from "react";
import Layout from "../components/Layout"; import Layout from "../components/Layout";
import Overlay from "../components/Overlay";
import MusicComponent from "../components/MusicComponent"; import MusicComponent from "../components/MusicComponent";
import TVComponent from "../components/TVComponent"; import TVComponent from "../components/TVComponent";
import GameComponent from "../components/GameComponent"; import GameComponent from "../components/GameComponent";
@@ -6,14 +8,28 @@ import FantasyStatus from "../components/FantasyStatus";
import PictureCarousel from "../components/modules/PictureCarousel"; import PictureCarousel from "../components/modules/PictureCarousel";
export default function App() { export default function App() {
const [selectedImage, setSelectedImage] = useState<string>("");
return ( return (
<Layout> <Layout>
{selectedImage !== "" && (
<Overlay onClose={() => setSelectedImage("")}>
<img
draggable={false}
className="select-none"
width="400"
height="400"
src={selectedImage}
/>
</Overlay>
)}
<div className="my-2 space-y-4"> <div className="my-2 space-y-4">
<PictureCarousel onClick={(url) => setSelectedImage(url)} />
<div className="border border-white border-solid p-2 rounded-lg flex justify-between"> <div className="border border-white border-solid p-2 rounded-lg flex justify-between">
<h1 className="text-2xl font-bold">welcome to my site !</h1> <h1 className="text-2xl font-bold">welcome to my site !</h1>
</div> </div>
<PictureCarousel />
<GameComponent /> <GameComponent />
<div className="border border-white border-solid rounded-lg p-2"> <div className="border border-white border-solid rounded-lg p-2">