Spaces:
Paused
Paused
Update components/GlassCard.js
Browse files- 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 |
-
|
|
|
|
| 6 |
|
| 7 |
-
{/* THE FRAME
|
| 8 |
-
<div className="relative w-full
|
| 9 |
|
| 10 |
-
{/* LAYER 1: The
|
| 11 |
-
|
| 12 |
-
|
| 13 |
-
|
| 14 |
-
|
| 15 |
-
|
| 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
|
| 28 |
-
{
|
| 29 |
-
|
| 30 |
-
|
| 31 |
-
|
| 32 |
-
|
| 33 |
-
{
|
| 34 |
-
|
| 35 |
-
|
| 36 |
-
|
| 37 |
-
|
| 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>
|