forked from Lilly-Protocol/lily-frontend
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathTimeline.tsx
More file actions
44 lines (39 loc) · 1.33 KB
/
Copy pathTimeline.tsx
File metadata and controls
44 lines (39 loc) · 1.33 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
import type { ReactNode } from 'react';
export interface TimelineEvent {
id: string;
date: string;
title: string;
description?: string;
icon?: ReactNode;
}
interface TimelineProps {
events: TimelineEvent[];
className?: string;
}
export function Timeline({ events, className = '' }: TimelineProps) {
return (
<div className={`relative space-y-8 ${className}`}>
{/* Vertical line */}
<div className="absolute left-4 top-2 bottom-2 w-px bg-border" aria-hidden />
{events.map((event) => (
<div key={event.id} className="relative pl-12">
{/* Node marker */}
<div className="absolute left-0 top-1 flex h-8 w-8 items-center justify-center rounded-full border border-border bg-background text-primary shadow-sm">
{event.icon ?? (
<span className="block h-2.5 w-2.5 rounded-full bg-primary" />
)}
</div>
<time className="text-xs font-medium uppercase tracking-wide text-muted-foreground">
{event.date}
</time>
<h3 className="mt-1 text-lg font-semibold text-foreground">{event.title}</h3>
{event.description && (
<p className="mt-1 text-sm leading-relaxed text-muted-foreground">
{event.description}
</p>
)}
</div>
))}
</div>
);
}