Files
ipv6-sims/app/components/home/AgendaSection.tsx
T

172 lines
7.3 KiB
TypeScript

"use client";
type AgendaItem = {
order: string;
time: string;
title: string;
description: string;
};
type Props = {
data: {
id: string;
eyebrow: string;
title: string;
description: string;
items: AgendaItem[];
};
};
const renderFormattedText = (text: string) => {
if (!text) return "";
const lines = text.split("\n");
return lines.map((line, lineIndex) => {
// Split the line by markdown bold (**bold**) and italic (*italic*)
const parts = line.split(/(\*\*.*?\*\*|\*.*?\*)/g);
const renderedLine = parts.map((part, partIndex) => {
if (part.startsWith("**") && part.endsWith("**")) {
return (
<strong key={partIndex} className="text-primary font-bold">
{part.slice(2, -2)}
</strong>
);
}
if (part.startsWith("*") && part.endsWith("*")) {
return (
<em key={partIndex} className="italic text-on-surface-variant/80">
{part.slice(1, -1)}
</em>
);
}
return part;
});
return (
<span key={lineIndex} className="block min-h-[1.25rem]">
{renderedLine}
</span>
);
});
};
export default function AgendaSection({ data }: Props) {
return (
<section className="py-16 lg:py-24 max-w-hd mx-auto px-[var(--spacing-gutter)]" id={data.id}>
{/* Section Header */}
<div className="flex flex-col lg:flex-row justify-between lg:items-end mb-16 lg:mb-28 gap-8">
<div className="max-w-3xl">
<span className="font-[var(--font-label-caps)] text-xs lg:text-sm text-primary block mb-4 lg:mb-6 tracking-[0.25em] uppercase">
{data.eyebrow}
</span>
<h2 className="font-[var(--font-display-lg)] text-on-surface uppercase tracking-tight text-[clamp(1.75rem,3vw+1rem,3.5rem)]">
{data.title}
</h2>
</div>
<p className="text-on-surface-variant/60 text-base lg:text-lg max-w-md xl:text-right">
{data.description}
</p>
</div>
{/* Timeline Container */}
<div className="relative w-full max-w-5xl mx-auto pl-10 lg:pl-0">
{/* Central vertical line */}
<div
className="absolute left-4 lg:left-1/2 top-4 bottom-4 w-[2px] bg-gradient-to-b from-primary via-primary/45 to-primary/5 -translate-x-1/2 pointer-events-none"
style={{ content: '""' }}
/>
{/* Timeline Items */}
<div className="space-y-12 lg:space-y-16">
{data.items.map((item, index) => {
const isEven = index % 2 === 0;
return (
<div key={item.order} className="relative w-full group">
{/* Timeline Dot (glowing on hover) */}
<div
className="absolute left-[-24px] lg:left-1/2 top-6 lg:top-8 -translate-x-1/2 w-4 h-4 rounded-full bg-background border-2 border-primary z-20 group-hover:scale-125 group-hover:bg-primary group-hover:shadow-[0_0_10px_#c5a059] transition-all duration-300 status-led"
/>
{/* Left/Right alternating grid layout */}
<div className="grid grid-cols-1 lg:grid-cols-2 gap-4 lg:gap-16 w-full">
{isEven ? (
<>
{/* Left: Card (Desktop) / Full content (Mobile) */}
<div className="order-1 lg:order-1">
<div className="glass-panel p-6 lg:p-8 rounded-3xl relative overflow-hidden hover:border-primary/50 transition-colors duration-300">
<span className="absolute top-6 right-6 text-xs lg:text-sm font-[var(--font-display-lg)] text-primary/30 group-hover:text-primary transition-colors duration-300">
{item.order}
</span>
{/* Mobile-only time badge */}
<div className="lg:hidden mb-3">
<span className="font-[var(--font-display-lg)] text-base text-primary">
{item.time}
</span>
</div>
<h3 className="font-[var(--font-display-lg)] text-base lg:text-lg text-on-surface mb-3 leading-snug pr-8">
{renderFormattedText(item.title)}
</h3>
{item.description && (
<div className="text-xs lg:text-sm text-on-surface-variant/75 leading-relaxed border-t border-primary/10 pt-3 mt-3">
{renderFormattedText(item.description)}
</div>
)}
</div>
</div>
{/* Right: Time badge (Desktop-only) */}
<div className="order-2 lg:order-2 hidden lg:flex items-center justify-start pl-4">
<span className="font-[var(--font-display-lg)] text-xl lg:text-[22px] text-primary group-hover:text-on-surface transition-colors duration-300">
{item.time}
</span>
</div>
</>
) : (
<>
{/* Left: Time badge (Desktop-only) */}
<div className="order-2 lg:order-1 hidden lg:flex items-center justify-end pr-4 text-right">
<span className="font-[var(--font-display-lg)] text-xl lg:text-[22px] text-primary group-hover:text-on-surface transition-colors duration-300">
{item.time}
</span>
</div>
{/* Right: Card (Desktop) / Full content (Mobile) */}
<div className="order-1 lg:order-2">
<div className="glass-panel p-6 lg:p-8 rounded-3xl relative overflow-hidden hover:border-primary/50 transition-colors duration-300">
<span className="absolute top-6 right-6 text-xs lg:text-sm font-[var(--font-display-lg)] text-primary/30 group-hover:text-primary transition-colors duration-300">
{item.order}
</span>
{/* Mobile-only time badge */}
<div className="lg:hidden mb-3">
<span className="font-[var(--font-display-lg)] text-base text-primary">
{item.time}
</span>
</div>
<h3 className="font-[var(--font-display-lg)] text-base lg:text-lg text-on-surface mb-3 leading-snug pr-8">
{renderFormattedText(item.title)}
</h3>
{item.description && (
<div className="text-xs lg:text-sm text-on-surface-variant/75 leading-relaxed border-t border-primary/10 pt-3 mt-3">
{renderFormattedText(item.description)}
</div>
)}
</div>
</div>
</>
)}
</div>
</div>
);
})}
</div>
</div>
</section>
);
}