MCPcopy Create free account
hub / github.com/dailydotdev/apps / DefaultListItem

Function DefaultListItem

packages/shared/src/components/widgets/SimilarPosts.tsx:54–95  ·  view source on GitHub ↗
({ post, onLinkClick }: PostProps)

Source from the content-addressed store, hash-verified

52const textContainerClassName = 'flex flex-col ml-3 mr-2 flex-1';
53
54const DefaultListItem = ({ post, onLinkClick }: PostProps): ReactElement => {
55 const trendingDescription = getTrendingDescription(post.trending);
56 return (
57 <article
58 className={classNames(
59 'group relative -mx-4 flex items-start px-4 py-3 hover:bg-surface-hover',
60 styles.card,
61 )}
62 >
63 <Link href={getPostPath(post)} passHref prefetch={false}>
64 <CardLink title={post.title} {...combinedClicks(onLinkClick)} />
65 </Link>
66 <LazyImage
67 imgSrc={post.source?.image ?? ''}
68 imgAlt={post.source?.name ?? ''}
69 className={imageClassName}
70 />
71 <div className={textContainerClassName}>
72 <h5
73 className={classNames(
74 'multi-truncate mb-0.5 text-ellipsis break-words text-text-primary typo-callout',
75 styles.title,
76 )}
77 >
78 {post.title}
79 </h5>
80 {trendingDescription ? (
81 <div className="flex items-center text-text-tertiary typo-footnote">
82 <HotLabel />
83 <div className="ml-2">{trendingDescription}</div>
84 </div>
85 ) : (
86 <PostEngagementCounts
87 upvotes={post.numUpvotes ?? 0}
88 comments={post.numComments ?? 0}
89 className="text-text-tertiary"
90 />
91 )}
92 </div>
93 </article>
94 );
95};
96
97const DefaultListItemPlaceholder = (): ReactElement => (
98 <article aria-busy className="relative -mx-4 flex items-start px-4 py-3">

Callers

nothing calls this directly

Calls 3

getTrendingDescriptionFunction · 0.90
getPostPathFunction · 0.90
combinedClicksFunction · 0.90

Tested by

no test coverage detected