From 71680252a4efbd74292853d3784a81b6e1d42b74 Mon Sep 17 00:00:00 2001 From: gbanyan Date: Tue, 18 Nov 2025 17:01:22 +0800 Subject: [PATCH] Show only previous/next cards in storyline rail --- components/post-storyline-nav.tsx | 54 +++++++++++++++---------------- 1 file changed, 27 insertions(+), 27 deletions(-) diff --git a/components/post-storyline-nav.tsx b/components/post-storyline-nav.tsx index 739fc6d..ba3cce4 100644 --- a/components/post-storyline-nav.tsx +++ b/components/post-storyline-nav.tsx @@ -8,11 +8,12 @@ interface Props { } interface StationConfig { - key: 'older' | 'current' | 'newer'; + key: 'older' | 'newer'; label: string; post?: Post; rel?: 'prev' | 'next'; subtitle: string; + align: 'start' | 'end'; } export function PostStorylineNav({ current, newer, older }: Props) { @@ -22,20 +23,16 @@ export function PostStorylineNav({ current, newer, older }: Props) { label: '上一站', post: older, subtitle: older ? '回顧這篇' : '到達起點', - rel: 'prev' - }, - { - key: 'current', - label: '你在這裡', - post: current, - subtitle: '' + rel: 'prev', + align: 'end' }, { key: 'newer', label: '下一站', post: newer, subtitle: newer ? '繼續前往' : '尚無新章', - rel: 'next' + rel: 'next', + align: 'start' } ]; @@ -49,10 +46,13 @@ export function PostStorylineNav({ current, newer, older }: Props) { -
- {stations.map((station) => ( - - ))} +
+ +
+
+
@@ -60,14 +60,14 @@ export function PostStorylineNav({ current, newer, older }: Props) { } function Station({ station }: { station: StationConfig }) { - const { post, label, subtitle, rel, key } = station; - const isCurrent = key === 'current'; + const { post, label, subtitle, rel, align } = station; + const alignClass = align === 'end' ? 'items-end text-right' : 'items-start text-left'; if (!post) { return ( -
+

{label}

-

{subtitle}

+

{subtitle}

); } @@ -76,22 +76,22 @@ function Station({ station }: { station: StationConfig }) {

{label}

-

+

{post.title}

- {subtitle && ( - - {subtitle} - - )} - + + {subtitle} + + ); }