Skip to content

Create professional demos and 3D mockups in seconds, directly in your browser

feat: add overlay-15 and its preview image; update image configuration to include new overlay

CristianOlivera1507b55f4d958
diff --git a/app/components/ui/home/SocialReactions.tsx b/app/components/ui/home/SocialReactions.tsx
index 939f6dd..a673cbe 100644
--- a/app/components/ui/home/SocialReactions.tsx
+++ b/app/components/ui/home/SocialReactions.tsx
@@ -1,5 +1,5 @@
"use client";
-import React, { useRef, MouseEvent, useState, useCallback, memo, useMemo } from "react";
+import React, { useRef, MouseEvent, useState, useCallback, memo, useMemo, useEffect } from "react";
import { Icon } from "@iconify/react";
import { useTranslations } from "next-intl";
@@ -369,20 +369,42 @@ CustomSocialCard.displayName = "CustomSocialCard";
const InstagramReelCard = memo(({ data }: { data: SocialPost }) => {
const t = useTranslations("socialReactions");
+ const [isVisible, setIsVisible] = useState(false);
+ const cardRef = useRef<HTMLElement>(null);
+
const handleRedirect = useCallback(() => {
window.open(data.postUrl, "_blank", "noopener,noreferrer");
}, [data.postUrl]);
+ useEffect(() => {
+ const observer = new IntersectionObserver(
+ ([entry]) => {
+ if (entry.isIntersecting) {
+ setIsVisible(true);
+ observer.disconnect();
+ }
+ },
+ { rootMargin: "300px" }
+ );
+
+ if (cardRef.current) {
+ observer.observe(cardRef.current);
+ }
+
+ return () => observer.disconnect();
+ }, []);
+
return (
<article
+ ref={cardRef}
className={`w-[calc(100vw-4rem)] sm:w-[calc(100vw-4rem)] max-w-132 shrink-0 relative overflow-hidden squircle-element-xl border border-white/15 bg-black text-white shadow-2xl transition duration-200 hover:border-white/30 flex flex-col justify-between select-none shadow-xl ${CARD_HEIGHT}`}
>
- <div className="absolute inset-0 h-full w-full pointer-events-none z-0">
+ <div className="absolute inset-0 h-full w-full pointer-events-none z-0 bg-neutral-900">
<video
- className="h-full w-full object-cover"
- src={data.content.videoUrl}
+ className={`h-full w-full object-cover transition-opacity duration-500 ${isVisible ? 'opacity-100' : 'opacity-0'}`}
+ src={isVisible ? data.content.videoUrl : undefined}
playsInline
- preload="auto"
+ preload="none"
autoPlay
muted
loop
@@ -411,12 +433,16 @@ const InstagramReelCard = memo(({ data }: { data: SocialPost }) => {
<div className="text-[15px] font-semibold flex items-center gap-1">
{data.author.name}
{data.author.isVerified && (
- <Icon icon="mdi:check-decagram" className="text-[#0095f6] h-[14px] w-[14px]" />
+ <Icon
+ icon="mdi:check-decagram"
+ className="text-[#0095f6] h-[14px] w-[14px]"
+ />
)}
</div>
<div className="text-xs text-white/75">{data.author.followers}</div>
</div>
</div>
+
<div
onClick={handleRedirect}
className="flex items-center justify-center p-2 rounded-full cursor-pointer hover:bg-white/10 transition"
diff --git a/lib/canvas-elements.config.ts b/lib/canvas-elements.config.ts
index 85f16ae..9808405 100644
--- a/lib/canvas-elements.config.ts
+++ b/lib/canvas-elements.config.ts
@@ -48,6 +48,7 @@ export const PINNED_IMAGE_ITEMS = [
{ id: "overlay-08", name: "Overlay 8", imagePath: "/elements/images/overlays/overlay-08.webp" },
{ id: "overlay-09", name: "Overlay 9", imagePath: "/elements/images/overlays/overlay-09.webp" },
{ id: "overlay-14", name: "Overlay 14", imagePath: "/elements/images/overlays/overlay-14.webp" },
+ { id: "overlay-15", name: "Overlay 15", imagePath: "/elements/images/overlays/overlay-15.webp" },
{ id: "asset-05", name: "Asset 5", imagePath: "/elements/images/assets/asset-05.webp" },
{ id: "asset-06", name: "Asset 6", imagePath: "/elements/images/assets/asset-06.webp" },
{ id: "asset-07", name: "Asset 7", imagePath: "/elements/images/assets/asset-07.webp" },
@@ -67,7 +68,6 @@ export const PINNED_IMAGE_ITEMS = [
{ id: "sticker-71", name: "Sticker 71", imagePath: "/elements/images/stickers/sticker-71.webp" },
{ id: "sticker-72", name: "Sticker 72", imagePath: "/elements/images/stickers/sticker-72.webp" },
{ id: "sticker-73", name: "Sticker 73", imagePath: "/elements/images/stickers/sticker-73.webp" },
- { id: "sticker-74", name: "Sticker 74", imagePath: "/elements/images/stickers/sticker-74.webp" },
];
export const SVG_CATEGORIES: SvgCategory[] = [
@@ -118,7 +118,7 @@ export const IMAGE_CATEGORIES: ImageCategory[] = [
id: "overlays",
title: "Superposiciones",
items: [
- ...generateImageItems("overlays", "overlay", 14)
+ ...generateImageItems("overlays", "overlay", 15)
]
},
{
diff --git a/public/elements/images/overlays/overlay-15-preview.webp b/public/elements/images/overlays/overlay-15-preview.webp
new file mode 100644
index 0000000..9477989
Binary files /dev/null and b/public/elements/images/overlays/overlay-15-preview.webp differ
diff --git a/public/elements/images/overlays/overlay-15.webp b/public/elements/images/overlays/overlay-15.webp
new file mode 100644
index 0000000..00c548c
Binary files /dev/null and b/public/elements/images/overlays/overlay-15.webp differ