mirror of
https://github.com/aljazceru/landscape-template.git
synced 2026-01-31 04:04:27 +01:00
- store post's body as markdown - stories page design changes - thick borders post details page - make text-editor toolbar sticky - fix update post api - change dropdown icons to emojis - remove vote/comments stats from postDetailsPage - remove "Type of post" component from createPostPage & replace it with back button - change insert tags placeholder text
39 lines
1.7 KiB
TypeScript
39 lines
1.7 KiB
TypeScript
import Skeleton from 'react-loading-skeleton'
|
|
import { Link } from 'react-router-dom'
|
|
import Avatar from 'src/features/Profiles/Components/Avatar/Avatar'
|
|
import { useTrendingPostsQuery } from 'src/graphql'
|
|
import { random } from 'src/utils/helperFunctions'
|
|
|
|
export default function TrendingCard() {
|
|
|
|
const trendingPosts = useTrendingPostsQuery()
|
|
|
|
|
|
|
|
return (
|
|
<div className="bg-white rounded-8 border-2 border-gray-100 p-16">
|
|
<h3 className="text-body2 font-bolder mb-16">Trending on BOLT.FUN</h3>
|
|
<ul className='flex flex-col'>
|
|
{
|
|
trendingPosts.loading ?
|
|
Array(4).fill(0).map((_, idx) => <li key={idx} className="flex items-start gap-8">
|
|
<Skeleton circle width={24} height={24} />
|
|
<p className="text-body5 font-medium flex-grow"><Skeleton width={'80%'} />
|
|
<Skeleton width={`${random(30, 65)}%`} /></p>
|
|
</li>
|
|
)
|
|
:
|
|
trendingPosts.data?.getTrendingPosts.map(post => {
|
|
return <Link key={post.id} to={`/blog/post/${post.__typename}/${post.id}`} className="border-b py-16 last-of-type:border-b-0">
|
|
<li className="flex items-start gap-8">
|
|
<Avatar width={24} src={post.author.avatar} />
|
|
<p className="text-body5 font-medium">{post.title}</p>
|
|
</li>
|
|
</Link>
|
|
}
|
|
)}
|
|
</ul>
|
|
</div>
|
|
)
|
|
}
|