feat: complete dynamic JSON-driven photo tools frontend connected to FastAPI backend
This commit is contained in:
@@ -0,0 +1,111 @@
|
||||
import React from 'react';
|
||||
import Link from 'next/link';
|
||||
import { Sparkles, ArrowRight, Smartphone } from 'lucide-react';
|
||||
import { resolveLocalised, ToolItem, AppItem, VariantSpec } from '@/types';
|
||||
import { TryItWidget } from './TryItWidget';
|
||||
|
||||
interface HeroSectionProps {
|
||||
title?: any;
|
||||
subtitle?: any;
|
||||
variant?: string;
|
||||
badge?: any;
|
||||
tryIt?: {
|
||||
toolRef: string;
|
||||
};
|
||||
tool?: ToolItem | null;
|
||||
homeApp?: AppItem | null;
|
||||
variants?: VariantSpec[];
|
||||
locale?: string;
|
||||
}
|
||||
|
||||
export function HeroSection({
|
||||
title,
|
||||
subtitle,
|
||||
variant = 'centered',
|
||||
badge,
|
||||
tool,
|
||||
homeApp,
|
||||
variants = [],
|
||||
locale = 'en',
|
||||
}: HeroSectionProps) {
|
||||
const resolvedTitle = resolveLocalised(title, locale);
|
||||
const resolvedSubtitle = resolveLocalised(subtitle, locale);
|
||||
const resolvedBadge = resolveLocalised(badge, locale);
|
||||
|
||||
if (variant === 'tryit' && tool) {
|
||||
return (
|
||||
<section className="relative overflow-hidden pt-8 pb-16 lg:pt-14 lg:pb-24">
|
||||
{/* Ambient Gradient Background Glow */}
|
||||
<div className="absolute top-0 left-1/2 -translate-x-1/2 w-full max-w-7xl h-96 bg-gradient-to-tr from-blue-500/10 via-teal-500/10 to-indigo-500/10 blur-3xl pointer-events-none -z-10" />
|
||||
|
||||
<div className="max-w-7xl mx-auto px-4 sm:px-6 lg:px-8">
|
||||
<div className="text-center max-w-3xl mx-auto space-y-4 mb-10">
|
||||
{resolvedBadge && (
|
||||
<div className="inline-flex items-center space-x-2 px-3.5 py-1.5 rounded-full bg-blue-50 dark:bg-blue-950/60 border border-blue-200 dark:border-blue-800 text-xs font-semibold text-blue-700 dark:text-blue-300">
|
||||
<Sparkles className="w-3.5 h-3.5 text-blue-500" />
|
||||
<span>{resolvedBadge}</span>
|
||||
</div>
|
||||
)}
|
||||
<h1 className="text-4xl sm:text-5xl lg:text-6xl font-extrabold text-slate-900 dark:text-white tracking-tight leading-tight">
|
||||
{resolvedTitle}
|
||||
</h1>
|
||||
<p className="text-lg text-slate-600 dark:text-slate-300 leading-relaxed">
|
||||
{resolvedSubtitle}
|
||||
</p>
|
||||
</div>
|
||||
|
||||
{/* Embedded Interactive Try-It Widget */}
|
||||
<div className="max-w-4xl mx-auto">
|
||||
<TryItWidget
|
||||
tool={tool}
|
||||
homeApp={homeApp}
|
||||
variants={variants}
|
||||
locale={locale}
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
);
|
||||
}
|
||||
|
||||
// Centered or Standard Hero
|
||||
return (
|
||||
<section className="relative overflow-hidden pt-12 pb-16 lg:pt-20 lg:pb-24 text-center">
|
||||
<div className="absolute top-0 left-1/2 -translate-x-1/2 w-full max-w-7xl h-80 bg-gradient-to-b from-blue-500/10 to-transparent blur-3xl pointer-events-none -z-10" />
|
||||
|
||||
<div className="max-w-4xl mx-auto px-4 sm:px-6 lg:px-8 space-y-6">
|
||||
{resolvedBadge && (
|
||||
<div className="inline-flex items-center space-x-2 px-3.5 py-1.5 rounded-full bg-blue-50 dark:bg-blue-950/60 border border-blue-200 dark:border-blue-800 text-xs font-semibold text-blue-700 dark:text-blue-300">
|
||||
<Sparkles className="w-3.5 h-3.5" />
|
||||
<span>{resolvedBadge}</span>
|
||||
</div>
|
||||
)}
|
||||
|
||||
<h1 className="text-4xl sm:text-5xl lg:text-6xl font-extrabold text-slate-900 dark:text-white tracking-tight leading-tight">
|
||||
{resolvedTitle}
|
||||
</h1>
|
||||
|
||||
<p className="text-lg sm:text-xl text-slate-600 dark:text-slate-300 max-w-2xl mx-auto">
|
||||
{resolvedSubtitle}
|
||||
</p>
|
||||
|
||||
<div className="flex flex-wrap items-center justify-center gap-4 pt-4">
|
||||
<Link
|
||||
href="/tools"
|
||||
className="inline-flex items-center space-x-2 px-6 py-3.5 rounded-xl font-semibold text-white bg-blue-600 hover:bg-blue-700 shadow-md shadow-blue-500/20 transition-all hover:scale-105 active:scale-95"
|
||||
>
|
||||
<span>Explore All Free Tools</span>
|
||||
<ArrowRight className="w-4 h-4" />
|
||||
</Link>
|
||||
<Link
|
||||
href="/apps"
|
||||
className="inline-flex items-center space-x-2 px-6 py-3.5 rounded-xl font-semibold text-slate-700 dark:text-slate-200 bg-slate-100 dark:bg-slate-800 hover:bg-slate-200 dark:hover:bg-slate-700 transition-colors"
|
||||
>
|
||||
<Smartphone className="w-4 h-4 text-slate-500" />
|
||||
<span>Mobile Apps Suite</span>
|
||||
</Link>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
);
|
||||
}
|
||||
Reference in New Issue
Block a user