Shinhati2023 commited on
Commit
31e52f9
·
verified ·
1 Parent(s): a6b6597

Update components/GlassCard.js

Browse files
Files changed (1) hide show
  1. components/GlassCard.js +30 -28
components/GlassCard.js CHANGED
@@ -1,22 +1,28 @@
1
- import { motion } from "framer-motion";
2
-
3
  export default function GlassCard({ image, caption, price }) {
4
  return (
5
- <div className="relative w-full h-full flex items-center justify-center">
 
6
 
7
- {/* THE FRAME WRAPPER */}
8
- <div className="relative w-full max-w-[360px] aspect-[9/16]">
9
 
10
- {/* LAYER 1: The Model Image (Tucked behind the glass) */}
11
- <div className="absolute top-[4%] bottom-[15%] left-[6%] right-[6%] z-0 bg-white rounded-lg overflow-hidden">
12
- <img
13
- src={image}
14
- alt="Model"
15
- className="w-full h-full object-cover"
16
- />
 
 
 
 
 
 
 
17
  </div>
18
 
19
- {/* LAYER 2: The Glass Frame (Overlay) */}
20
  <div className="absolute inset-0 z-10 pointer-events-none">
21
  <img
22
  src="/assets/picture_frame.png"
@@ -24,21 +30,17 @@ export default function GlassCard({ image, caption, price }) {
24
  />
25
  </div>
26
 
27
- {/* LAYER 3: The Content (Inside the Bottom Ledge) */}
28
- {/* We position this precisely to fit your PNG's bottom bar */}
29
- <div className="absolute bottom-[4%] left-[8%] right-[8%] h-[10%] z-20 flex items-center justify-between px-2">
30
-
31
- {/* Caption (Left side of ledge) */}
32
- <span className="font-manrope font-bold text-[#1E293B] text-xs w-2/3 leading-tight line-clamp-2 opacity-80">
33
- {caption}
34
- </span>
35
-
36
- {/* Price (Right side of ledge - Styled like a glass pill) */}
37
- <span className="font-manrope font-extrabold text-[#0EA5E9] text-base">
38
- {price}
39
- </span>
40
-
41
- </div>
42
 
43
  </div>
44
  </div>
 
 
 
1
  export default function GlassCard({ image, caption, price }) {
2
  return (
3
+ // FULL SCREEN CONTAINER - Centers the frame
4
+ <div className="relative w-full h-full flex items-center justify-center p-2">
5
 
6
+ {/* THE FRAME ITSELF (Expands to fit screen, max width for mobile feel) */}
7
+ <div className="relative w-full h-[85vh] max-w-md">
8
 
9
+ {/* LAYER 1: The Content Area (Behind the Glass)
10
+ Adjust top/bottom percentages to fit YOUR specific png frame borders.
11
+ */}
12
+ <div className="absolute top-[4%] bottom-[15%] left-[5%] right-[5%] z-0 rounded-xl overflow-hidden bg-white/10">
13
+
14
+ {/* LOGIC: Only show image if one is uploaded. Otherwise, show empty placeholder */}
15
+ {image ? (
16
+ <img src={image} className="w-full h-full object-cover" />
17
+ ) : (
18
+ <div className="w-full h-full flex items-center justify-center bg-gray-50/20">
19
+ <p className="text-gray-400 font-light text-sm">Waiting for upload...</p>
20
+ </div>
21
+ )}
22
+
23
  </div>
24
 
25
+ {/* LAYER 2: The Glass Frame PNG (The Overlay) */}
26
  <div className="absolute inset-0 z-10 pointer-events-none">
27
  <img
28
  src="/assets/picture_frame.png"
 
30
  />
31
  </div>
32
 
33
+ {/* LAYER 3: The Caption Area (Only appears IF there is text) */}
34
+ {(caption || price) && (
35
+ <div className="absolute bottom-[5%] left-[8%] right-[8%] z-20 flex flex-col items-center">
36
+ {caption && (
37
+ <p className="text-slate-800 font-bold text-sm mb-1">{caption}</p>
38
+ )}
39
+ {price && (
40
+ <p className="text-[#0EA5E9] font-extrabold text-lg">{price}</p>
41
+ )}
42
+ </div>
43
+ )}
 
 
 
 
44
 
45
  </div>
46
  </div>