Skip to content

Commit

Permalink
fix: post related
Browse files Browse the repository at this point in the history
Signed-off-by: Innei <i@innei.in>
  • Loading branch information
Innei committed Mar 1, 2024
1 parent fe234f4 commit d8ba333
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ const PostPage = (props: PostModel) => {
<SummarySwitcher data={props} />
<PostOutdate />

<PostRelated />
<PostRelated infoText="阅读此文章之前,你可能需要首先阅读以下的文章才能更好的理解上下文。" />
</header>
<WrappedElementProvider eoaDetect>
<ReadIndicatorForMobile />
Expand All @@ -67,6 +67,7 @@ const PostPage = (props: PostModel) => {
</WrappedElementProvider>
</article>
<ClientOnly>
<PostRelated infoText="关联阅读" />
<PostCopyright />
{/* <SubscribeBell defaultType="post_c" /> */}
<XLogInfoForPost />
Expand Down
10 changes: 6 additions & 4 deletions src/components/modules/post/PostRelated.tsx
Original file line number Diff line number Diff line change
@@ -1,10 +1,14 @@
'use client'

import type { FC } from 'react'

import { useCurrentPostDataSelector } from '~/providers/post/CurrentPostDataProvider'

import { PeekLink } from '../peek/PeekLink'

export const PostRelated = () => {
export const PostRelated: FC<{
infoText: string
}> = ({ infoText }) => {
const related = useCurrentPostDataSelector((s) => s?.related)
if (!related) {
return null
Expand All @@ -16,9 +20,7 @@ export const PostRelated = () => {
return (
<div data-hide-print className="mb-5 mt-8">
<h3 className="text-lg font-medium">
<span>
阅读此文章之前,你可能需要首先阅读以下的文章才能更好的理解上下文。
</span>
<span>{infoText}</span>
</h3>
<ul className="list-inside list-disc">
{related.map((post) => {
Expand Down

0 comments on commit d8ba333

Please sign in to comment.