Skip to content

Commit ed8cf36

Browse files
committed
Complete detail page navigation endpoints
1 parent 4ddcbff commit ed8cf36

1 file changed

Lines changed: 8 additions & 2 deletions

File tree

app/detail-page.tsx

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,8 @@ export default function DetailPage({
8080
heroAside,
8181
pageClassName = '',
8282
}: DetailPageProps) {
83+
const homeSectionLabel = backLabel.replace(/^/, '');
84+
8385
return <main className={`detail-page ${pageClassName}`} style={{ '--detail-accent': accent } as CSSProperties}>
8486
<nav className="detail-nav" aria-label="详情页导航">
8587
<a className="detail-back" href={backHref}><PiArrowLeftBold aria-hidden="true" />{backLabel}</a>
@@ -129,8 +131,12 @@ export default function DetailPage({
129131
{showcase}
130132

131133
<nav className="detail-pagination" aria-label="详情页切换">
132-
{previous ? <a href={previous.href}><PiArrowLeftBold aria-hidden="true" /><span><small>上一个</small>{previous.label}</span></a> : <span />}
133-
{next ? <a href={next.href}><span><small>下一个</small>{next.label}</span><PiArrowRightBold aria-hidden="true" /></a> : <span />}
134+
{previous
135+
? <a href={previous.href}><PiArrowLeftBold aria-hidden="true" /><span><small>上一个</small>{previous.label}</span></a>
136+
: <a href={backHref}><PiArrowLeftBold aria-hidden="true" /><span><small>返回首页</small>{homeSectionLabel}</span></a>}
137+
{next
138+
? <a href={next.href}><span><small>下一个</small>{next.label}</span><PiArrowRightBold aria-hidden="true" /></a>
139+
: <a href={backHref}><span><small>返回首页</small>{homeSectionLabel}</span><PiArrowRightBold aria-hidden="true" /></a>}
134140
</nav>
135141
</main>;
136142
}

0 commit comments

Comments
 (0)