Add glow and animation to timeline

This commit is contained in:
2025-11-19 01:46:37 +08:00
parent 48ce66a3e6
commit eefc38d562
2 changed files with 34 additions and 3 deletions

View File

@@ -10,11 +10,20 @@ export function TimelineWrapper({ children, className }: TimelineWrapperProps) {
const items = Children.toArray(children); const items = Children.toArray(children);
return ( return (
<div className={clsx('relative pl-8', className)}> <div className={clsx('relative pl-8', className)}>
<span className="pointer-events-none absolute left-3 top-0 h-full w-[2px] bg-gradient-to-b from-blue-500 via-blue-200 to-slate-200 shadow-[0_0_8px_rgba(59,130,246,0.35)] dark:from-cyan-400 dark:via-cyan-300 dark:to-slate-700" aria-hidden="true" /> <span
className="pointer-events-none absolute left-3 top-0 h-full w-[2px] rounded-full bg-gradient-to-b from-blue-500 via-blue-200 to-slate-200 shadow-[0_0_10px_rgba(59,130,246,0.45)] dark:from-cyan-400 dark:via-cyan-300 dark:to-slate-700"
aria-hidden="true"
/>
<span
className="pointer-events-none absolute left-3 top-0 h-full w-[6px] rounded-full bg-gradient-to-b from-blue-500/20 via-blue-200/15 to-transparent blur-[12px]"
aria-hidden="true"
/>
<span className="timeline-scroll-dot pointer-events-none absolute left-3 top-0 h-2 w-2 -translate-x-1/2 rounded-full bg-white shadow-[0_0_8px_rgba(96,165,250,0.7)]" aria-hidden="true" />
<div className="space-y-4"> <div className="space-y-4">
{items.map((child, index) => ( {items.map((child, index) => (
<div key={index} className="relative pl-6"> <div key={index} className="relative pl-6 sm:pl-8">
<span className="pointer-events-none absolute left-0 top-1/2 h-[2px] w-6 -translate-x-full -translate-y-1/2 bg-gradient-to-r from-blue-400 to-transparent dark:from-cyan-300" aria-hidden="true" /> <span className="pointer-events-none absolute left-0 top-1/2 h-[2px] w-7 -translate-x-full -translate-y-1/2 bg-gradient-to-r from-blue-400/80 via-blue-300/60 to-transparent dark:from-cyan-300/80 dark:via-cyan-200/60" aria-hidden="true" />
{child} {child}
</div> </div>
))} ))}

View File

@@ -29,6 +29,28 @@ body {
font-family: var(--font-system-sans); font-family: var(--font-system-sans);
} }
@keyframes timeline-scroll {
0% {
transform: translate(-50%, -10%);
opacity: 0;
}
15% {
opacity: 1;
}
85% {
opacity: 1;
}
100% {
transform: translate(-50%, 110%);
opacity: 0;
}
}
.timeline-scroll-dot {
animation: timeline-scroll 6s linear infinite;
will-change: transform, opacity;
}
.toc-target-highlight { .toc-target-highlight {
@apply bg-yellow-50/60 dark:bg-yellow-900/40 transition-colors duration-500; @apply bg-yellow-50/60 dark:bg-yellow-900/40 transition-colors duration-500;
} }