Files
goal-planner/frontend/components/LandingPage.tsx
T
2026-11-02 17:15:39 +08:00

116 lines
7.6 KiB
TypeScript

import React from 'react';
import { useLanguage } from '../i18n/LanguageContext';
interface LandingPageProps {
onGetStarted: () => void;
}
const GoalIcon = () => <svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" strokeWidth={1.5} stroke="currentColor" className="w-6 h-6"><path strokeLinecap="round" strokeLinejoin="round" d="M15.042 21.672L13.684 16.6m0 0l-2.51 2.225.569-9.47 5.227 7.917-3.286-.672zM12 2.25C6.477 2.25 2.25 6.477 2.25 12s4.227 9.75 9.75 9.75 9.75-4.227 9.75-9.75S17.523 2.25 12 2.25z" /></svg>;
const GenerateIcon = () => <svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" strokeWidth={1.5} stroke="currentColor" className="w-6 h-6"><path strokeLinecap="round" strokeLinejoin="round" d="M9.813 15.904L9 18.75l-.813-2.846a4.5 4.5 0 00-3.09-3.09L2.25 12l2.846-.813a4.5 4.5 0 003.09-3.09L9 5.25l.813 2.846a4.5 4.5 0 003.09 3.09L15.75 12l-2.846.813a4.5 4.5 0 00-3.09 3.09zM18.259 8.715L18 9.75l-.259-1.035a3.375 3.375 0 00-2.455-2.456L14.25 6l1.036-.259a3.375 3.375 0 002.455-2.456L18 2.25l.259 1.035a3.375 3.375 0 002.456 2.456L21.75 6l-1.035.259a3.375 3.375 0 00-2.456 2.456zM16.898 20.562L16.25 22.5l-.648-1.938a2.25 2.25 0 01-1.423-1.423L12.25 18.5l1.938-.648a2.25 2.25 0 011.423-1.423l1.938-.648.648 1.938a2.25 2.25 0 01-1.423 1.423l-.648 1.938z" /></svg>;
const ExecuteIcon = () => <svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" strokeWidth={1.5} stroke="currentColor" className="w-6 h-6"><path strokeLinecap="round" strokeLinejoin="round" d="M9 12.75L11.25 15 15 9.75M21 12a9 9 0 11-18 0 9 9 0 0118 0z" /></svg>;
const FeatureCard: React.FC<{ icon: React.ReactElement; title: string; children: React.ReactNode }> = ({ icon, title, children }) => (
<div className="bg-white dark:bg-slate-800 p-6 sm:p-7 rounded-2xl shadow-sm border border-slate-200/80 dark:border-slate-700 text-left hover:-translate-y-0.5 hover:shadow-md transition-all duration-200">
<div className="flex items-center justify-center h-12 w-12 rounded-2xl bg-emerald-50 dark:bg-emerald-900/30 text-emerald-600 dark:text-emerald-400 mb-4">
{icon}
</div>
<h3 className="text-lg font-semibold text-slate-900 dark:text-slate-100 mb-2">{title}</h3>
<p className="text-slate-600 dark:text-slate-400">{children}</p>
</div>
);
const LandingPage: React.FC<LandingPageProps> = ({ onGetStarted }) => {
const { t } = useLanguage();
return (
<div className="text-center">
{/* Hero Section */}
<section className="py-14 md:py-20">
<p className="inline-flex items-center rounded-full bg-emerald-50 dark:bg-emerald-900/30 text-emerald-700 dark:text-emerald-300 text-xs font-semibold px-3 py-1 mb-5">Goal Planner</p>
<h1 className="text-4xl md:text-6xl font-extrabold text-slate-900 dark:text-slate-100 mb-5 tracking-tight leading-[1.1]">
{t('heroTitle')}
</h1>
<p className="max-w-2xl mx-auto text-lg md:text-xl text-slate-600 dark:text-slate-400 mb-8 leading-relaxed">
{t('heroSubtitle')}
</p>
<button
onClick={onGetStarted}
className="bg-emerald-600 text-white font-semibold px-8 py-3.5 rounded-xl hover:bg-emerald-700 transition-all shadow-lg shadow-emerald-200/70 dark:shadow-none hover:-translate-y-0.5"
>
{t('createFirstPlan')}
</button>
</section>
{/* Features Section */}
<section id="how-it-works" className="py-14 md:py-20 bg-white/70 dark:bg-slate-800/40 -mx-4 px-4 sm:mx-0 sm:px-8 sm:rounded-3xl border border-slate-200/70 dark:border-slate-700/60">
<h2 className="text-3xl font-bold text-slate-900 dark:text-slate-100 mb-2">{t('howItWorks')}</h2>
<p className="max-w-xl mx-auto text-slate-600 dark:text-slate-400 mb-12">{t('howItWorksSub')}</p>
<div className="grid md:grid-cols-3 gap-5 max-w-5xl mx-auto text-left">
<FeatureCard
icon={<GoalIcon />}
title={t('step1Title')}
>
{t('step1Body')}
</FeatureCard>
<FeatureCard
icon={<GenerateIcon />}
title={t('step2Title')}
>
{t('step2Body')}
</FeatureCard>
<FeatureCard
icon={<ExecuteIcon />}
title={t('step3Title')}
>
{t('step3Body')}
</FeatureCard>
</div>
</section>
{/* Testimonials */}
<section id="testimonials" className="py-16 md:py-24">
<h2 className="text-3xl font-bold text-slate-900 dark:text-slate-100 mb-12">{t('testimonialsTitle')}</h2>
<div className="max-w-4xl mx-auto grid md:grid-cols-2 gap-8">
<div className="bg-white dark:bg-slate-800 p-6 sm:p-7 rounded-2xl shadow-sm border border-slate-200/80 dark:border-slate-700 text-left">
<p className="text-slate-600 dark:text-slate-400 mb-4">{t('testimonial1')}</p>
<p className="font-semibold text-slate-900 dark:text-slate-100">Goal Planner</p>
<p className="text-sm text-slate-500 dark:text-slate-500">{t('testimonial1Role')}</p>
</div>
<div className="bg-white dark:bg-slate-800 p-6 sm:p-7 rounded-2xl shadow-sm border border-slate-200/80 dark:border-slate-700 text-left">
<p className="text-slate-600 dark:text-slate-400 mb-4">{t('testimonial2')}</p>
<p className="font-semibold text-slate-900 dark:text-slate-100">Balaji</p>
<p className="text-sm text-slate-500 dark:text-slate-500">{t('testimonial2Role')}</p>
</div>
</div>
</section>
{/* About Section */}
<section id="about" className="py-14 md:py-20 bg-white/70 dark:bg-slate-800/40 -mx-4 px-4 sm:mx-0 sm:px-8 sm:rounded-3xl border border-slate-200/70 dark:border-slate-700/60">
<div className="max-w-4xl mx-auto text-center">
<h2 className="text-3xl font-bold text-slate-900 dark:text-slate-100 mb-4">{t('missionTitle')}</h2>
<p className="text-lg text-slate-600 dark:text-slate-400 mb-8">
{t('missionBody')}
</p>
</div>
</section>
{/* Final CTA */}
<section className="py-16 md:py-24">
<div className="max-w-4xl mx-auto text-center bg-gradient-to-br from-emerald-600 to-teal-600 dark:from-emerald-700 dark:to-teal-800 text-white py-14 sm:py-16 px-6 sm:px-10 rounded-3xl shadow-lg shadow-emerald-200/50 dark:shadow-none">
<h2 className="text-3xl sm:text-4xl font-extrabold mb-4">{t('ctaTitle')}</h2>
<p className="text-lg text-emerald-50 mb-8 max-w-2xl mx-auto">
{t('ctaBody')}
</p>
<button
onClick={onGetStarted}
className="bg-white text-emerald-700 font-bold px-10 py-4 rounded-xl hover:bg-emerald-50 transition-all shadow-xl hover:-translate-y-0.5 text-lg"
>
{t('ctaButton')}
</button>
</div>
</section>
</div>
);
};
export default LandingPage;