Files
webb/src/components/tools/AlternatingFeaturesSection.tsx
T

141 lines
6.0 KiB
TypeScript

'use client';
import React from 'react';
import { AlternatingFeature, resolveLocalised } from '@/types';
import { Sparkles, CheckCircle2 } from 'lucide-react';
import { KineticText } from '@/components/magicui/kinetic-text';
interface AlternatingFeaturesSectionProps {
features?: AlternatingFeature[];
locale?: string;
sectionTitle?: string;
sectionSubtitle?: string;
className?: string;
}
export function AlternatingFeaturesSection({
features = [],
locale = 'en',
sectionTitle = 'Engineered for Precision & Realism',
sectionSubtitle = 'Explore the neural architecture and features powering this vision studio model.',
className = '',
}: AlternatingFeaturesSectionProps) {
if (!features || features.length === 0) return null;
return (
<section className={`py-16 sm:py-24 border-t border-rule bg-paper overflow-hidden ${className}`}>
<div className="max-w-6xl mx-auto px-4 sm:px-6 lg:px-8 space-y-16 sm:space-y-24">
{/* Section Heading */}
<div className="text-center max-w-2xl mx-auto space-y-3">
<div className="inline-flex items-center gap-2 px-3.5 py-1 rounded-full bg-accent/10 border border-accent/20 text-accent text-xs font-semibold font-body">
<Sparkles className="w-3.5 h-3.5" />
<span>Core Capabilities</span>
</div>
<h2 className="text-3xl sm:text-4xl font-display font-bold text-ink tracking-tight">
<KineticText>{sectionTitle}</KineticText>
</h2>
<p className="text-sm sm:text-base text-ink-2 font-body leading-relaxed">
{sectionSubtitle}
</p>
</div>
{/* Alternating Feature Items: Left-Right Zig-Zag */}
<div className="space-y-16 sm:space-y-24">
{features.map((feature, idx) => {
const isEven = idx % 2 === 0;
const title = resolveLocalised(feature.title, locale);
const desc = resolveLocalised(feature.description, locale);
const badge = feature.badge ? resolveLocalised(feature.badge, locale) : undefined;
const caption = feature.caption ? resolveLocalised(feature.caption, locale) : undefined;
return (
<div
key={idx}
className="grid grid-cols-1 lg:grid-cols-12 gap-8 lg:gap-12 items-center"
>
{/* Visual / Image Block */}
<div
className={`lg:col-span-6 ${
isEven ? 'order-1 lg:order-1' : 'order-1 lg:order-2'
}`}
>
<div className="group relative rounded-3xl overflow-hidden bg-paper-2 border border-rule shadow-sheet transition-all duration-300 hover:shadow-glow">
{/* Aspect Frame */}
<div className="aspect-[16/10] sm:aspect-[4/3] w-full overflow-hidden relative">
{/* eslint-disable-next-line @next/next/no-img-element */}
<img
src={feature.image}
alt={title}
loading="lazy"
decoding="async"
className="w-full h-full object-cover transition-transform duration-700 group-hover:scale-105"
/>
{/* Badge Overlay */}
{badge && (
<div className="absolute top-4 left-4 z-10 px-3 py-1 rounded-full bg-ink/80 backdrop-blur-md border border-white/20 text-[11px] font-semibold text-paper-hi shadow-xs font-body">
{badge}
</div>
)}
{/* Optional Caption Overlay */}
{caption && (
<div className="absolute bottom-3 inset-x-3 z-10 p-2.5 rounded-2xl bg-paper-hi/90 backdrop-blur-md border border-rule text-xs font-body text-ink-2 shadow-sm">
{caption}
</div>
)}
</div>
</div>
</div>
{/* Text Paragraph Block */}
<div
className={`lg:col-span-6 space-y-4 ${
isEven ? 'order-2 lg:order-2' : 'order-2 lg:order-1'
}`}
>
<div className="space-y-2">
<span className="font-mono text-xs font-bold text-accent uppercase tracking-wider">
Feature 0{idx + 1}
</span>
<h3 className="text-2xl sm:text-3xl font-display font-bold text-ink tracking-tight">
{title}
</h3>
</div>
<p className="text-sm sm:text-base text-ink-2 font-body leading-relaxed">
{desc}
</p>
{/* Optional Metrics Chips */}
{feature.metrics && feature.metrics.length > 0 && (
<div className="pt-2 flex flex-wrap gap-3">
{feature.metrics.map((metric, mIdx) => (
<div
key={mIdx}
className="px-3.5 py-2 rounded-2xl bg-paper-2 border border-rule text-xs font-body space-y-0.5"
>
<div className="font-display font-bold text-ink text-sm">
{metric.value}
</div>
<div className="text-[11px] text-muted">{metric.label}</div>
</div>
))}
</div>
)}
{/* Quality Assurance Highlight */}
<div className="pt-2 flex items-center gap-2 text-xs font-body text-emerald-600">
<CheckCircle2 className="w-4 h-4" />
<span>Processed locally in volatile GPU RAM · Zero server retention</span>
</div>
</div>
</div>
);
})}
</div>
</div>
</section>
);
}