forked from UKSOURCE/ipv6
216 lines
9.7 KiB
TypeScript
216 lines
9.7 KiB
TypeScript
"use client";
|
|
|
|
type AgendaItem = {
|
|
order: string;
|
|
time: string;
|
|
title: string;
|
|
description: string;
|
|
avatar?: 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) {
|
|
const base = process.env.NEXT_PUBLIC_BASE_PATH || "";
|
|
|
|
const renderAvatar = (avatarUrl: string, sizeClass: string) => (
|
|
<div className={`${sizeClass} rounded-full overflow-hidden border border-primary/20 bg-white/5 flex items-center justify-center backdrop-blur-sm shadow-inner shrink-0`}>
|
|
{avatarUrl.includes("placeholder") ? (
|
|
<svg className="w-1/2 h-1/2 text-primary/60" fill="none" stroke="currentColor" viewBox="0 0 24 24" strokeWidth={1.5}>
|
|
<path strokeLinecap="round" strokeLinejoin="round" d="M15.75 6a3.75 3.75 0 1 1-7.5 0 3.75 3.75 0 0 1 7.5 0ZM4.501 20.118a7.5 7.5 0 0 1 14.998 0A17.933 17.933 0 0 1 12 21.75c-2.676 0-5.216-.584-7.499-1.632Z" />
|
|
</svg>
|
|
) : (
|
|
// eslint-disable-next-line @next/next/no-img-element
|
|
<img
|
|
src={`${base}${avatarUrl}`}
|
|
alt="Speaker"
|
|
className="w-full h-full object-cover"
|
|
/>
|
|
)}
|
|
</div>
|
|
);
|
|
|
|
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 lg:right-auto lg:left-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 text-balance pr-8 lg:pr-0 lg:pl-8 lg:text-right">
|
|
{renderFormattedText(item.title)}
|
|
</h3>
|
|
{!item.description && item.avatar && (
|
|
<div className="flex lg:justify-end justify-start mb-3">
|
|
{renderAvatar(item.avatar, "w-10 h-10 lg:w-12 lg:h-12")}
|
|
</div>
|
|
)}
|
|
{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 flex flex-row lg:flex-row-reverse items-center gap-4">
|
|
{item.avatar && (
|
|
<div className="shrink-0">
|
|
{renderAvatar(item.avatar, "w-10 h-10 lg:w-12 lg:h-12")}
|
|
</div>
|
|
)}
|
|
<div className="flex-1 lg:text-right">
|
|
{renderFormattedText(item.description)}
|
|
</div>
|
|
</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 text-balance pr-8">
|
|
{renderFormattedText(item.title)}
|
|
</h3>
|
|
{!item.description && item.avatar && (
|
|
<div className="flex justify-start mb-3">
|
|
{renderAvatar(item.avatar, "w-10 h-10 lg:w-12 lg:h-12")}
|
|
</div>
|
|
)}
|
|
{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 flex flex-row items-center gap-4">
|
|
{item.avatar && (
|
|
<div className="shrink-0">
|
|
{renderAvatar(item.avatar, "w-10 h-10 lg:w-12 lg:h-12")}
|
|
</div>
|
|
)}
|
|
<div className="flex-1">
|
|
{renderFormattedText(item.description)}
|
|
</div>
|
|
</div>
|
|
)}
|
|
</div>
|
|
</div>
|
|
</>
|
|
)}
|
|
|
|
</div>
|
|
</div>
|
|
);
|
|
})}
|
|
</div>
|
|
</div>
|
|
</section>
|
|
);
|
|
}
|