feat(homepage): add travelling image pipeline to how-it-works, round our-tools corners, organize media, and clean hero header

This commit is contained in:
2026-11-05 15:25:23 +05:30
parent b00566fb99
commit 8715e23be0
41 changed files with 407 additions and 68 deletions
@@ -2,7 +2,7 @@
import React, { useState, useRef, useEffect, useCallback } from 'react';
import Link from 'next/link';
import { ArrowRight, Sparkles, Video, Sliders, Image as ImageIcon } from 'lucide-react';
import { ArrowRight, Sparkles } from 'lucide-react';
import { TextAnimate } from '@/components/magicui/text-animate';
import { ToolItem } from '@/types';
@@ -186,10 +186,14 @@ function ShiftableRow({ items }: { items: ToolMediaItem[] }) {
>
{/* Window Container with strictly locked pixel height & landscape aspect */}
{item.mediaType === 'comparison' ? (
<div className="group block relative w-full h-[220px] sm:h-[240px] lg:h-[260px] rounded-2xl sm:rounded-3xl overflow-hidden bg-slate-950 border border-slate-900/[0.08] shadow-cream-sm">
<div
style={{ borderRadius: '28px' }}
className="group block relative w-full h-[220px] sm:h-[240px] lg:h-[260px] rounded-[28px] sm:rounded-[36px] overflow-hidden isolate [mask-image:radial-gradient(white,black)] [-webkit-mask-image:-webkit-radial-gradient(white,black)] bg-slate-950 border border-slate-900/[0.08] shadow-cream-sm"
>
{/* GPU-Composited Shadow Elevation Layer */}
<div
className="absolute -inset-px rounded-2xl sm:rounded-3xl shadow-cream-lg opacity-0 group-hover:opacity-100 transition-opacity duration-700 ease-[cubic-bezier(0.16,1,0.3,1)] pointer-events-none z-30"
style={{ borderRadius: '28px' }}
className="absolute -inset-px rounded-[28px] sm:rounded-[36px] shadow-cream-lg opacity-0 group-hover:opacity-100 transition-opacity duration-700 ease-[cubic-bezier(0.16,1,0.3,1)] pointer-events-none z-30"
aria-hidden="true"
/>
@@ -205,41 +209,22 @@ function ShiftableRow({ items }: { items: ToolMediaItem[] }) {
<span>TRY TOOL</span>
<ArrowRight className="w-2.5 h-2.5" />
</Link>
{/* Hover Media Type Pill */}
<div
className="absolute top-3 left-3 z-20 pointer-events-none opacity-0 group-hover:opacity-100 transition-opacity duration-500 ease-[cubic-bezier(0.16,1,0.3,1)]"
>
<span className="inline-flex items-center gap-1.5 px-2.5 py-1 rounded-full text-[10px] font-mono font-bold tracking-wider uppercase bg-slate-950/85 backdrop-blur-md text-white border border-white/20">
<Sliders className="w-3 h-3 text-amber-400" />
<span>comparison</span>
</span>
</div>
</div>
) : (
<Link
href={`/tools/${item.slug}`}
className="group block relative w-full h-[220px] sm:h-[240px] lg:h-[260px] rounded-2xl sm:rounded-3xl overflow-hidden bg-slate-950 border border-slate-900/[0.08] shadow-cream-sm cursor-pointer"
style={{ borderRadius: '28px' }}
className="group block relative w-full h-[220px] sm:h-[240px] lg:h-[260px] rounded-[28px] sm:rounded-[36px] overflow-hidden isolate [mask-image:radial-gradient(white,black)] [-webkit-mask-image:-webkit-radial-gradient(white,black)] bg-slate-950 border border-slate-900/[0.08] shadow-cream-sm cursor-pointer"
>
{/* GPU-Composited Shadow Elevation Layer (Opacity-only transition, zero paint thrash) */}
<div
className="absolute -inset-px rounded-2xl sm:rounded-3xl shadow-cream-lg opacity-0 group-hover:opacity-100 transition-opacity duration-700 ease-[cubic-bezier(0.16,1,0.3,1)] pointer-events-none z-30"
style={{ borderRadius: '28px' }}
className="absolute -inset-px rounded-[28px] sm:rounded-[36px] shadow-cream-lg opacity-0 group-hover:opacity-100 transition-opacity duration-700 ease-[cubic-bezier(0.16,1,0.3,1)] pointer-events-none z-30"
aria-hidden="true"
/>
{/* Media Renderer */}
<ToolWindowMedia item={item} isHovered={isHovered} />
{/* Hover Media Type Pill (Smooth GPU Opacity Transition) */}
<div
className="absolute top-3 left-3 z-20 pointer-events-none opacity-0 group-hover:opacity-100 transition-opacity duration-500 ease-[cubic-bezier(0.16,1,0.3,1)]"
>
<span className="inline-flex items-center gap-1.5 px-2.5 py-1 rounded-full text-[10px] font-mono font-bold tracking-wider uppercase bg-slate-950/85 backdrop-blur-md text-white border border-white/20">
{item.mediaType === 'video' && <Video className="w-3 h-3 text-cyan-400" />}
{item.mediaType === 'photo' && <ImageIcon className="w-3 h-3 text-emerald-400" />}
<span>{item.mediaType}</span>
</span>
</div>
</Link>
)}
@@ -281,7 +266,8 @@ function ToolWindowMedia({ item, isHovered }: { item: ToolMediaItem; isHovered:
dividerRef.current.style.left = `${clamped}%`;
}
if (clipLayerRef.current) {
clipLayerRef.current.style.clipPath = `inset(0 ${100 - clamped}% 0 0)`;
clipLayerRef.current.style.clipPath = `inset(0 ${100 - clamped}% 0 0 round 28px 0 0 28px)`;
(clipLayerRef.current.style as any).webkitClipPath = `inset(0 ${100 - clamped}% 0 0 round 28px 0 0 28px)`;
}
if (handleRef.current) {
handleRef.current.setAttribute('aria-valuenow', `${Math.round(clamped)}`);
@@ -465,7 +451,10 @@ function ToolWindowMedia({ item, isHovered }: { item: ToolMediaItem; isHovered:
// 1. VIDEO (Strictly locked to fixed 680px centered width - ZERO ZOOM)
if (item.mediaType === 'video' && item.videoUrl) {
return (
<div className="relative w-full h-full overflow-hidden bg-slate-950">
<div
style={{ borderRadius: '28px' }}
className="relative w-full h-full overflow-hidden bg-slate-950 rounded-[28px] sm:rounded-[36px] isolate [mask-image:radial-gradient(white,black)] [-webkit-mask-image:-webkit-radial-gradient(white,black)]"
>
<video
ref={videoRef}
src={item.videoUrl}
@@ -475,10 +464,14 @@ function ToolWindowMedia({ item, isHovered }: { item: ToolMediaItem; isHovered:
loop
playsInline
preload="auto"
className="absolute inset-y-0 left-1/2 -translate-x-1/2 h-full w-[680px] max-w-none object-cover pointer-events-none transform-gpu will-change-transform [backface-visibility:hidden]"
style={{ borderRadius: '28px' }}
className="absolute inset-y-0 left-1/2 -translate-x-1/2 h-full w-[680px] max-w-none object-cover pointer-events-none [backface-visibility:hidden]"
/>
{/* GPU-composited overlay (opacity only) */}
<div className="absolute inset-0 bg-slate-950/10 opacity-100 group-hover:opacity-0 transition-opacity duration-700 ease-[cubic-bezier(0.16,1,0.3,1)] pointer-events-none" />
<div
style={{ borderRadius: '28px' }}
className="absolute inset-0 bg-slate-950/10 opacity-100 group-hover:opacity-0 transition-opacity duration-700 ease-[cubic-bezier(0.16,1,0.3,1)] pointer-events-none"
/>
</div>
);
}
@@ -494,29 +487,36 @@ function ToolWindowMedia({ item, isHovered }: { item: ToolMediaItem; isHovered:
onMouseMove={handleContainerPointerMove}
onPointerLeave={handleContainerPointerLeave}
onMouseLeave={handleContainerPointerLeave}
style={{ touchAction: 'pan-y' }}
className="relative w-full h-full select-none overflow-hidden bg-slate-950 transform-gpu [backface-visibility:hidden] cursor-ew-resize"
style={{
touchAction: 'pan-y',
borderRadius: '28px',
}}
className="relative w-full h-full select-none overflow-hidden bg-slate-950 rounded-[28px] sm:rounded-[36px] isolate [mask-image:radial-gradient(white,black)] [-webkit-mask-image:-webkit-radial-gradient(white,black)] cursor-ew-resize"
>
{/* Layer 1: AFTER Image (Base layer, fixed scale & position, 0% zoom) */}
<img
src={item.afterUrl}
alt="After"
className="absolute inset-y-0 left-1/2 -translate-x-1/2 h-full w-[680px] max-w-none object-cover pointer-events-none transform-gpu will-change-transform [backface-visibility:hidden]"
style={{ borderRadius: '28px' }}
className="absolute inset-y-0 left-1/2 -translate-x-1/2 h-full w-[680px] max-w-none object-cover pointer-events-none [backface-visibility:hidden]"
loading="lazy"
/>
{/* Layer 2: BEFORE Image (Clipped container-sized layer - 100% exact alignment with slider divider on phone & desktop) */}
<div
ref={clipLayerRef}
className="absolute inset-0 overflow-hidden pointer-events-none transform-gpu will-change-transform [backface-visibility:hidden]"
className="absolute inset-0 overflow-hidden rounded-[28px] sm:rounded-[36px] isolate [mask-image:radial-gradient(white,black)] [-webkit-mask-image:-webkit-radial-gradient(white,black)] pointer-events-none"
style={{
clipPath: 'inset(0 50% 0 0)',
borderRadius: '28px',
clipPath: 'inset(0 50% 0 0 round 28px 0 0 28px)',
WebkitClipPath: 'inset(0 50% 0 0 round 28px 0 0 28px)',
}}
>
<img
src={item.beforeUrl}
alt="Before"
className="absolute inset-y-0 left-1/2 -translate-x-1/2 h-full w-[680px] max-w-none object-cover pointer-events-none transform-gpu will-change-transform [backface-visibility:hidden]"
style={{ borderRadius: '28px' }}
className="absolute inset-y-0 left-1/2 -translate-x-1/2 h-full w-[680px] max-w-none object-cover pointer-events-none [backface-visibility:hidden]"
loading="lazy"
/>
</div>
@@ -565,15 +565,22 @@ function ToolWindowMedia({ item, isHovered }: { item: ToolMediaItem; isHovered:
// 3. PHOTO (Strictly locked to fixed 680px centered width - ZERO ZOOM)
return (
<div className="relative w-full h-full overflow-hidden bg-slate-950">
<div
style={{ borderRadius: '28px' }}
className="relative w-full h-full overflow-hidden bg-slate-950 rounded-[28px] sm:rounded-[36px] isolate [mask-image:radial-gradient(white,black)] [-webkit-mask-image:-webkit-radial-gradient(white,black)]"
>
<img
src={item.imageUrl || item.afterUrl || item.beforeUrl || '/brand/og-default.png'}
alt={item.title}
className="absolute inset-y-0 left-1/2 -translate-x-1/2 h-full w-[680px] max-w-none object-cover pointer-events-none transform-gpu will-change-transform [backface-visibility:hidden]"
style={{ borderRadius: '28px' }}
className="absolute inset-y-0 left-1/2 -translate-x-1/2 h-full w-[680px] max-w-none object-cover pointer-events-none [backface-visibility:hidden]"
loading="lazy"
/>
{/* GPU-composited overlay (opacity only) */}
<div className="absolute inset-0 bg-slate-950/10 opacity-100 group-hover:opacity-0 transition-opacity duration-700 ease-[cubic-bezier(0.16,1,0.3,1)] pointer-events-none" />
<div
style={{ borderRadius: '28px' }}
className="absolute inset-0 bg-slate-950/10 opacity-100 group-hover:opacity-0 transition-opacity duration-700 ease-[cubic-bezier(0.16,1,0.3,1)] pointer-events-none"
/>
</div>
);
}