Skip to content

Commit c29d57b

Browse files
committed
update homepage
1 parent 3e8e11a commit c29d57b

File tree

3 files changed

+657
-43
lines changed

3 files changed

+657
-43
lines changed

app/(home)/lightbox-image.tsx

Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
'use client';
2+
3+
import { useState } from 'react';
4+
import Image from 'next/image';
5+
import { X } from 'lucide-react';
6+
7+
interface LightboxImageProps {
8+
src: string;
9+
alt: string;
10+
width: number;
11+
height: number;
12+
className?: string;
13+
}
14+
15+
export function LightboxImage({ src, alt, width, height, className }: LightboxImageProps) {
16+
const [isOpen, setIsOpen] = useState(false);
17+
18+
return (
19+
<>
20+
{/* Thumbnail */}
21+
<div
22+
className="cursor-zoom-in hover:opacity-90 transition-opacity"
23+
onClick={() => setIsOpen(true)}
24+
>
25+
<Image
26+
src={src}
27+
alt={alt}
28+
width={width}
29+
height={height}
30+
className={className}
31+
/>
32+
</div>
33+
34+
{/* Lightbox Modal */}
35+
{isOpen && (
36+
<div
37+
className="fixed inset-0 z-50 flex items-center justify-center bg-black/90 p-4"
38+
onClick={() => setIsOpen(false)}
39+
>
40+
<button
41+
className="absolute top-4 right-4 p-2 text-white hover:bg-white/10 rounded-lg transition-colors"
42+
onClick={() => setIsOpen(false)}
43+
aria-label="Close lightbox"
44+
>
45+
<X className="w-6 h-6" />
46+
</button>
47+
<div className="relative max-w-7xl max-h-[90vh] w-full h-full flex items-center justify-center">
48+
<Image
49+
src={src}
50+
alt={alt}
51+
width={width}
52+
height={height}
53+
className="max-w-full max-h-full w-auto h-auto object-contain"
54+
onClick={(e) => e.stopPropagation()}
55+
/>
56+
</div>
57+
</div>
58+
)}
59+
</>
60+
);
61+
}

0 commit comments

Comments
 (0)