feat: limit post content to 10 lines and height of ~320px then display show more link

This commit is contained in:
Stevan Freeborn
2023-09-11 20:45:01 -05:00
parent 636cd96e8b
commit c4348d9b5e
+13 -1
View File
@@ -104,8 +104,20 @@ export default function Post({ post }: { post: PostWithUserDto }) {
</div> </div>
</div> </div>
</div> </div>
<div className='max-h-80 overflow-hidden text-ellipsis'>
<PostContent
content={Text.of(post.content.slice(0, 10)).toString()}
/>
</div>
<div> <div>
<PostContent content={Text.of(post.content).toString()} /> {post.content.length > 10 ? (
<Link
className='font-semibold text-primary-accent'
href={`/posts/${post._id}`}
>
Show more
</Link>
) : null}
</div> </div>
<div></div> <div></div>
</div> </div>