Create professional demos and 3D mockups in seconds, directly in your browser
feat: implement FeaturesShowcase component with video and image carousels
CristianOlivera11c7a74835d5a
diff --git a/app/components/ui/home/FeaturesShowcase.tsx b/app/components/ui/home/FeaturesShowcase.tsxnew file mode 100644index 0000000..5ecc427--- /dev/null+++ b/app/components/ui/home/FeaturesShowcase.tsx@@ -0,0 +1,204 @@+"use client";++import React, { useRef, MouseEvent, useState, useEffect } from "react";+import { useTranslations } from "next-intl";++const videosData = [+ { id: "v1", src: "/videos/showcase/demo1.mp4", poster: "/images/showcase/poster/demo1.avif", aspectRatio: "16/9" },+ { id: "v2", src: "/videos/showcase/demo2.mp4", poster: "/images/showcase/poster/demo2.avif", aspectRatio: "4/3" },+ { id: "v3", src: "/videos/showcase/demo3.mp4", poster: "/images/showcase/poster/demo3.avif", aspectRatio: "16/9" },+ { id: "v4", src: "/videos/showcase/demo4.mp4", poster: "/images/showcase/poster/demo4.avif", aspectRatio: "4/3" },+ { id: "v5", src: "/videos/showcase/demo5.mp4", poster: "/images/showcase/poster/demo5.avif", aspectRatio: "16/9" },+];++const imagesData = [+ { id: "i1", src: "/images/showcase/data/shot1.avif", alt: "Laptop", aspectRatio: "4/3" },+ { id: "i2", src: "/images/showcase/data/shot2.avif", alt: "iPhone", aspectRatio: "3/4" },+ { id: "i3", src: "/images/showcase/data/shot3.avif", alt: "iPhone", aspectRatio: "4/3" },+ { id: "i4", src: "/images/showcase/data/shot4.avif", alt: "Browser", aspectRatio: "16/9" },+ { id: "i5", src: "/images/showcase/data/shot5.avif", alt: "Browser", aspectRatio: "1/1" },+ { id: "i6", src: "/images/showcase/data/shot6.avif", alt: "Browser", aspectRatio: "4/3" },+];++const LazyVideo = ({ src, poster }: { src: string; poster: string }) => {+ const t = useTranslations("featuresShowcase");+ const containerRef = useRef<HTMLDivElement>(null);+ const [isIntersecting, setIsIntersecting] = useState(false);++ useEffect(() => {+ const observer = new IntersectionObserver(+ ([entry]) => {+ if (entry.isIntersecting) {+ setIsIntersecting(true);+ observer.disconnect();+ }+ },+ { rootMargin: "300px", threshold: 0 }+ );++ if (containerRef.current) {+ observer.observe(containerRef.current);+ }++ return () => observer.disconnect();+ }, []);++ return (+ <div ref={containerRef} className="w-full h-full relative bg-neutral-900">+ {!isIntersecting && (+ <img+ src={poster}+ alt={t("common.videoThumbnail")}+ onDragStart={(e) => e.preventDefault()}+ className="w-full h-full object-cover pointer-events-none select-none [-webkit-user-drag:none]"+ />+ )}++ {isIntersecting && (+ <video+ src={src}+ poster={poster}+ autoPlay+ muted+ loop+ playsInline+ draggable={false}+ className="absolute inset-0 w-full h-full object-cover pointer-events-none"+ />+ )}+ </div>+ );+};++const DraggableCarousel = ({ children }: { children: React.ReactNode }) => {+ const scrollRef = useRef<HTMLDivElement>(null);+ const [isDragging, setIsDragging] = useState(false);+ const startX = useRef(0);+ const scrollLeft = useRef(0);++ const handleMouseDown = (e: MouseEvent) => {+ if (!scrollRef.current) return;+ setIsDragging(true);+ scrollRef.current.classList.add("cursor-grabbing");+ scrollRef.current.classList.remove("cursor-grab");+ startX.current = e.pageX - scrollRef.current.offsetLeft;+ scrollLeft.current = scrollRef.current.scrollLeft;+ };++ const handleMouseUpOrLeave = () => {+ setIsDragging(false);+ if (scrollRef.current) {+ scrollRef.current.classList.add("cursor-grab");+ scrollRef.current.classList.remove("cursor-grabbing");+ }+ };++ const handleMouseMove = (e: MouseEvent) => {+ if (!isDragging || !scrollRef.current) return;+ e.preventDefault();+ const x = e.pageX - scrollRef.current.offsetLeft;+ const walk = (x - startX.current) * 1.5;+ scrollRef.current.scrollLeft = scrollLeft.current - walk;+ };++ return (+ <div className="w-full">+ <div+ ref={scrollRef}+ onMouseDown={handleMouseDown}+ onMouseLeave={handleMouseUpOrLeave}+ onMouseUp={handleMouseUpOrLeave}+ onMouseMove={handleMouseMove}+ className="flex gap-6 overflow-x-auto hide-scroll w-full cursor-grab select-none"+ >+ <div+ className="flex-shrink-0 pointer-events-none"+ style={{ width: "max(1.5rem, calc((100vw - 1280px) / 2))" }}+ />+ {children}+ <div+ className="flex-shrink-0 pointer-events-none"+ style={{ width: "max(1.5rem, calc((100vw - 1280px) / 2))" }}+ />+ </div>+ </div>+ );+};++export default function FeaturesShowcase() {+ const t = useTranslations("featuresShowcase");++ return (+ <div className="w-full bg-black">+ <style>{`+ .hide-scroll::-webkit-scrollbar {+ display: none;+ }+ .hide-scroll {+ -ms-overflow-style: none;+ scrollbar-width: none;+ }+ `}</style>++ <section className="w-full py-24 overflow-hidden">+ <div className="max-w-7xl mx-auto px-6 lg:px-8 mb-16">+ <h2 className="text-4xl sm:text-5xl font-semibold tracking-tight text-white mb-6">+ {t("videos.titleLine1")} <br className="hidden sm:block" />+ <span className="text-transparent bg-clip-text bg-gradient-to-r from-neutral-300 to-neutral-600">+ {t("videos.titleLine2")}+ </span>+ </h2>+ <p className="text-xl text-neutral-400 font-light leading-relaxed max-w-xl">+ {t("videos.description")}+ </p>+ </div>+ <DraggableCarousel>+ {videosData.map((feature) => (+ <article key={feature.id} className="flex-shrink-0 h-[350px] md:h-[450px]">+ <div+ className="relative h-full squircle-element-xl overflow-hidden border border-white/10 group shadow-2xl"+ style={{ aspectRatio: feature.aspectRatio || "16/9" }}+ >+ <LazyVideo src={feature.src} poster={feature.poster} />+ </div>+ </article>+ ))}+ </DraggableCarousel>+ </section>++ <section className="w-full py-24 overflow-hidden">+ <div className="max-w-7xl mx-auto px-6 lg:px-8 mb-16">+ <h2 className="text-4xl sm:text-5xl font-semibold tracking-tight text-white mb-6">+ {t("images.titleLine1")} <br className="hidden sm:block" />+ <span className="text-transparent bg-clip-text bg-gradient-to-r from-neutral-300 to-neutral-600">+ {t("images.titleLine2")}+ </span>+ </h2>+ <p className="text-xl text-neutral-400 font-light leading-relaxed max-w-xl">+ {t("images.description")}+ </p>+ </div>+ <DraggableCarousel>+ {imagesData.map((feature) => (+ <article key={feature.id} className="flex-shrink-0 h-[350px] md:h-[450px]">+ <div+ className="relative h-full squircle-element-xl overflow-hidden bg-neutral-900 border border-white/10 group shadow-2xl"+ style={{ aspectRatio: feature.aspectRatio || "16/9" }}+ >+ <img+ src={feature.src}+ alt={t(`alts.${feature.alt.toLowerCase()}`)}+ draggable={false}+ onDragStart={(e) => e.preventDefault()}+ loading="lazy"+ decoding="async"+ className="w-full h-full object-cover pointer-events-none select-none [-webkit-user-drag:none]"+ />+ </div>+ </article>+ ))}+ </DraggableCarousel>+ </section>+ </div>+ );+}\ No newline at end of filediff --git a/app/components/ui/home/Featuresgrid.tsx b/app/components/ui/home/Featuresgrid.tsxindex 9695993..7066879 100644--- a/app/components/ui/home/Featuresgrid.tsx+++ b/app/components/ui/home/Featuresgrid.tsx@@ -1,138 +1,159 @@"use client";-import React from "react";+import { useTranslations } from "next-intl";export default function FeaturesGrid() {+ const t = useTranslations("featuresGrid");+return (- <section className="w-full py-24 bg-black" aria-label="Product features">+ <section className="w-full py-24 bg-black" aria-label={t("ariaLabel")}><div className="max-w-7xl mx-auto px-6 lg:px-8">-- {/* Header Section */}<div className="max-w-2xl mb-16"><h2 className="text-4xl sm:text-5xl font-semibold tracking-tight text-white mb-6">- Everything you need to ship <br className="hidden sm:block" />+ {t("titleLine1")} <br className="hidden sm:block" /><span className="text-transparent bg-clip-text bg-gradient-to-r from-neutral-300 to-neutral-600">- stunning demos.+ {t("titleLine2")}</span></h2>- <p className="text-lg text-neutral-400 font-light leading-relaxed max-w-xl">- Record, enhance, and export - cinematic results directly in your browser, no installs required.+ <p className="text-xl text-neutral-400 font-light leading-relaxed max-w-xl">+ {t("description")}</p></div><div className="grid grid-cols-1 md:grid-cols-3 lg:grid-cols-4 gap-4 auto-rows-[300px]">-- <div className="relative group col-span-1 md:col-span-2 lg:col-span-2 lg:row-span-2 squircle-element-2xl bg-neutral-950 border border-white/10 overflow-hidden hover:border-white/20 transition-colors">- <div className="absolute inset-0 bg-[url('/images/bento/bg-phone.avif')] bg-cover bg-center transition-[transform,opacity] duration-500 group-hover:opacity-50" />- <div className="absolute inset-0 bg-gradient-to-t from-neutral-950 via-neutral-950/20 to-transparent pointer-events-none z-10" />- <div className="absolute top-0 inset-x-0 flex justify-center z-20">+ <article className="relative group col-span-1 md:col-span-2 lg:col-span-2 lg:row-span-2 squircle-element-2xl bg-neutral-950 border border-white/10 overflow-hidden hover:border-white/20 transition-colors">+ <div className="absolute inset-0 bg-[url('/images/bento/bg-phone.avif')] bg-cover bg-bottom transition-[transform,opacity] duration-500 group-hover:opacity-50" />+ <div className="absolute inset-0 bg-gradient-to-t from-neutral-950 via-neutral-950/60 sm:via-neutral-950/20 to-transparent pointer-events-none z-10" />+ <div className="absolute top-0 inset-x-0 flex justify-center z-20 pointer-events-none"><imgsrc="/images/bento/3d-device.webp"- alt="Abstract 3D rendering"- className="w-auto h-auto max-h-[550px] object-contain transition-transform duration-500 group-hover:scale-105"+ alt={t("alts.abstract3dRendering")}+ loading="lazy"+ decoding="async"+ className="w-auto h-auto max-h-[550px] object-contain transition-transform duration-500 group-hover:scale-105 select-none"/></div><div className="absolute bottom-0 left-0 p-8 z-30">- <h3 className="text-xl font-medium text-white mb-2">3D Device Mockups</h3>+ <h3 className="text-xl font-medium text-white mb-2">+ {t("cards.deviceMockups.title")}+ </h3><p className="text-neutral-400 text-sm max-w-sm">- Wrap your screen recordings in hyper-realistic 3D device frames with dynamic lighting and reflections.+ {t("cards.deviceMockups.description")}</p></div>- </div>- <div className="relative col-span-1 md:col-span-1 lg:col-span-2 squircle-element-2xl border border-neutral-200 overflow-hidden transition-colors pt-8 px-8 pb-0 flex flex-col justify-between bg-white bg-[linear-gradient(45deg,#e5e5e5_25%,transparent_25%),linear-gradient(-45deg,#e5e5e5_25%,transparent_25%),linear-gradient(45deg,transparent_75%,#e5e5e5_75%),linear-gradient(-45deg,transparent_75%,#e5e5e5_75%)] bg-[size:32px_32px] bg-[position:0_0,0_16px,16px_-16px,16px_0px]">+ </article>+ <article className="relative col-span-1 md:col-span-1 lg:col-span-2 squircle-element-2xl border border-neutral-200 overflow-hidden transition-colors pt-8 px-8 pb-0 flex flex-col justify-between bg-white bg-[linear-gradient(45deg,#e5e5e5_25%,transparent_25%),linear-gradient(-45deg,#e5e5e5_25%,transparent_25%),linear-gradient(45deg,transparent_75%,#e5e5e5_75%),linear-gradient(-45deg,transparent_75%,#e5e5e5_75%)] bg-[size:32px_32px] bg-[position:0_0,0_16px,16px_-16px,16px_0px]"><div className="relative z-30 pointer-events-none">- <h2 className="text-6xl font-bold tracking-tighter text-transparent bg-clip-text bg-gradient-to-b from-neutral-900 to-neutral-300 text-shadow-2xs">- Transparency+ <h2 className="text-4xl sm:text-6xl font-bold tracking-tighter text-transparent bg-clip-text bg-gradient-to-b from-neutral-900 to-neutral-300 text-shadow-2xs">+ {t("cards.transparency.title")}</h2></div>-<div className="relative w-full mt-24 h-[300px] flex justify-center items-start"><imgsrc="/images/bento/transparency-3.webp"- alt="Background layer 3"- className="absolute top-0 left-1/2 -translate-x-1/2 w-full aspect-video object-contain object-top scale-[0.80] -translate-y-24 cursor-pointer transition-all duration-300 ease-in-out hover:scale-[0.86] drop-shadow-[0_15px_15px_rgba(0,0,0,0.12)] z-10"+ alt={t("alts.backgroundLayer3")}+ loading="lazy"+ decoding="async"+ className="absolute top-0 left-1/2 -translate-x-1/2 w-full aspect-video object-contain object-top scale-[0.80] -translate-y-24 cursor-pointer transition-all duration-300 ease-in-out hover:scale-[0.86] drop-shadow-[0_15px_15px_rgba(0,0,0,0.12)] z-10 select-none"/>-<imgsrc="/images/bento/transparency-2.webp"- alt="Background layer 2"- className="absolute top-0 left-1/2 -translate-x-1/2 w-full aspect-video object-contain object-top scale-[0.90] -translate-y-12 cursor-pointer transition-all duration-300 ease-in-out hover:scale-[0.96] drop-shadow-[0_20px_20px_rgba(0,0,0,0.15)] z-15"+ alt={t("alts.backgroundLayer2")}+ loading="lazy"+ decoding="async"+ className="absolute top-0 left-1/2 -translate-x-1/2 w-full aspect-video object-contain object-top scale-[0.90] -translate-y-12 cursor-pointer transition-all duration-300 ease-in-out hover:scale-[0.96] drop-shadow-[0_20px_20px_rgba(0,0,0,0.15)] z-15 select-none"/>-<imgsrc="/images/bento/transparency.webp"- alt="Transparent preview"- className="absolute top-0 left-1/2 -translate-x-1/2 w-full aspect-video object-contain object-top scale-100 cursor-pointer transition-all duration-300 ease-in-out hover:scale-[1.05] drop-shadow-[0_25px_25px_rgba(0,0,0,0.18)] z-20"+ alt={t("alts.transparentPreview")}+ loading="lazy"+ decoding="async"+ className="absolute top-0 left-1/2 -translate-x-1/2 w-full aspect-video object-contain object-top scale-100 cursor-pointer transition-all duration-300 ease-in-out hover:scale-[1.05] drop-shadow-[0_25px_25px_rgba(0,0,0,0.18)] z-20 select-none"/></div>- </div>+ </article>-- <div className="relative group col-span-1 squircle-element-2xl bg-neutral-950 border border-white/10 overflow-hidden hover:border-white/20 transition-colors p-8 flex flex-col justify-between items-start">+ <article className="relative group col-span-1 squircle-element-2xl bg-neutral-950 border border-white/10 overflow-hidden hover:border-white/20 transition-colors p-8 flex flex-col justify-between items-start"><imgsrc="/images/bento/backgrounds.avif"- alt="Background pattern"- className="absolute inset-0 w-full h-full object-cover pointer-events-none opacity-100 transition-all duration-500 ease-in-out group-hover:scale-105 group-hover:opacity-50"+ alt={t("alts.backgroundPattern")}+ loading="lazy"+ decoding="async"+ className="absolute inset-0 w-full h-full object-cover pointer-events-none opacity-100 transition-all duration-500 ease-in-out group-hover:scale-105 group-hover:opacity-50 select-none"/><div className="absolute inset-0 bg-gradient-to-t from-black via-black/40 to-transparent pointer-events-none z-20 transition-all duration-500 ease-in-out group-hover:opacity-0" /><div className="absolute inset-0 bg-[radial-gradient(ellipse_at_bottom_right,_var(--tw-gradient-stops))] from-neutral-800/20 via-neutral-950/0 to-transparent pointer-events-none" />-<h2 className="text-6xl font-bold tracking-tighter text-transparent bg-clip-text bg-gradient-to-b from-white to-neutral-100 relative z-30 text-shadow-2xs">500+</h2>-<div className="relative z-30 mt-4">- <h3 className="text-lg font-medium text-white mb-1">Backgrounds</h3>+ <h3 className="text-lg font-medium text-white mb-1">+ {t("cards.backgrounds.title")}+ </h3></div>- </div>+ </article>- <div className="relative group col-span-1 squircle-element-2xl bg-neutral-950 border border-white/10 overflow-hidden hover:border-white/20 transition-colors p-8 min-h-[240px] flex flex-col justify-end items-start">+ <article className="relative group col-span-1 squircle-element-2xl bg-neutral-950 border border-white/10 overflow-hidden hover:border-white/20 transition-colors p-8 min-h-[240px] flex flex-col justify-end items-start"><div className="absolute inset-0 bg-[url('/images/bento/bg-zoom.avif')] bg-cover bg-center opacity-100 transition-all duration-500 ease-in-out group-hover:scale-105 group-hover:opacity-50" />- <div className="absolute bottom-0 right-0 z-10">+ <div className="absolute bottom-0 right-0 z-10 pointer-events-none"><imgsrc="/images/bento/zoom.webp"- alt="Bottom right asset"- className="w-auto h-auto max-h-[360px] object-contain transition-all duration-500 ease-in-out group-hover:scale-105 group-hover:rotate-3 drop-shadow-[0_25px_25px_rgba(0,0,0,0.65)]"+ alt={t("alts.bottomRightAsset")}+ loading="lazy"+ decoding="async"+ className="w-auto h-auto max-h-[360px] object-contain transition-all duration-500 ease-in-out group-hover:scale-105 group-hover:rotate-3 drop-shadow-[0_25px_25px_rgba(0,0,0,0.65)] select-none"/></div><div className="absolute inset-0 bg-gradient-to-t from-black via-black/40 to-transparent pointer-events-none z-20 transition-all duration-500 ease-in-out group-hover:opacity-0" /><div className="relative z-30">- <h3 className="text-lg font-medium text-white mb-1">Cinematic Zoom</h3>+ <h3 className="text-lg font-medium text-white mb-1">+ {t("cards.cinematicZoom.title")}+ </h3></div>- </div>+ </article>- <div className="relative group col-span-1 md:col-span-2 lg:col-span-2 squircle-element-2xl bg-neutral-950 border border-white/10 overflow-hidden hover:border-white/20 transition-colors p-8 flex flex-col justify-between">+ <article className="relative group col-span-1 md:col-span-2 lg:col-span-2 squircle-element-2xl bg-neutral-950 border border-white/10 overflow-hidden hover:border-white/20 transition-colors p-8 flex flex-col justify-between"><div className="absolute inset-0 bg-[url('/images/bento/bg-elements.avif')] bg-cover bg-bottom opacity-100 transition-all duration-500 ease-in-out group-hover:scale-105 group-hover:opacity-50" />- <div className="absolute bottom-0 right-0 z-10 max-w-[50%]">+ <div className="absolute bottom-0 right-0 z-10 max-w-[50%] pointer-events-none"><imgsrc="/images/bento/phone-elements.webp"- alt="Right asset"- className="w-auto h-auto max-h-[580px] object-contain transition-all duration-500 ease-in-out group-hover:scale-105 group-hover:rotate-3 drop-shadow-[0_20px_20px_rgba(0,0,0,0.65)]"+ alt={t("alts.rightAsset")}+ loading="lazy"+ decoding="async"+ className="w-auto h-auto max-h-[580px] object-contain transition-all duration-500 ease-in-out group-hover:scale-105 group-hover:rotate-3 drop-shadow-[0_20px_20px_rgba(0,0,0,0.65)] select-none"/></div><div className="absolute inset-0 bg-gradient-to-t from-black via-black/40 to-transparent pointer-events-none z-20 transition-all duration-500 ease-in-out group-hover:opacity-0" /><div className="relative z-30 mt-auto">- <h3 className="text-lg font-medium text-white mb-3">Elements & Layers</h3>+ <h3 className="text-lg font-medium text-white mb-3">+ {t("cards.elementsLayers.title")}+ </h3><div className="flex gap-3 flex-wrap">- {['Text Overlay', 'SVG Shapes', 'Blur Effects'].map((tag) => (- <span key={tag} className="px-3 py-1.5 rounded-lg border border-white/10 bg-white/5 text-xs text-neutral-300">- {tag}+ {["textOverlay", "svgShapes", "blurEffects"].map((tag) => (+ <span+ key={tag}+ className="px-3 py-1.5 rounded-lg border border-white/10 bg-white/5 text-xs text-neutral-300"+ >+ {t(`tags.${tag}`)}</span>))}</div></div>- </div>+ </article>- <div className="relative group col-span-1 md:col-span-1 lg:col-span-2 squircle-element-2xl bg-neutral-950 border border-white/10 overflow-hidden hover:border-white/20 transition-colors p-8 flex flex-col justify-end">+ <article className="relative group col-span-1 md:col-span-1 lg:col-span-2 squircle-element-2xl bg-neutral-950 border border-white/10 overflow-hidden hover:border-white/20 transition-colors p-8 flex flex-col justify-end"><div className="absolute inset-0 bg-[url('/images/bento/multi-track.avif')] bg-cover bg-bottom transition-all duration-500 ease-in-out group-hover:scale-105 group-hover:opacity-50" /><div className="absolute inset-0 bg-gradient-to-t from-black via-black/40 to-transparent pointer-events-none z-20 transition-all duration-500 ease-in-out group-hover:opacity-0" /><div className="relative z-30 mt-auto">- <h3 className="text-lg font-medium text-white mb-1">Multi-track Timeline</h3>- <p className="text-neutral-400 text-sm max-w-sm">Layer multiple videos, audio tracks, and zoom the canvas.</p>+ <h3 className="text-lg font-medium text-white mb-1">+ {t("cards.multiTrackTimeline.title")}+ </h3>+ <p className="text-neutral-400 text-sm max-w-sm">+ {t("cards.multiTrackTimeline.description")}+ </p></div>- </div>-+ </article></div></div></section>