fix: scroll to comment

This commit is contained in:
DIYgod 2023-06-16 22:38:46 +01:00
parent b64b5d08b8
commit dd592f3a3e
No known key found for this signature in database
1 changed files with 12 additions and 2 deletions

View File

@ -14,7 +14,11 @@ const key = ["PostFooterInView"]
const DynamicComment = dynamic(() => import("~/components/common/Comment"), {
// TODO Skeleton
loading: () => <p>Loading comments...</p>,
loading: () => (
<div className="xlog-comment comment" id="comments" data-hide-print>
<p>Loading comments...</p>
</div>
),
})
export const usePostFooterInView = () => {
@ -61,7 +65,13 @@ export const PostFooter = ({
page={page}
/>
</div>
{(inited || isInView) && <DynamicComment page={page} />}
{inited || isInView ? (
<DynamicComment page={page} />
) : (
<div className="xlog-comment comment" id="comments" data-hide-print>
<p>Loading comments...</p>
</div>
)}
</>
)
}