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

Function PostPreview

packages/shared/src/components/post/PostPreview.tsx:25–79  ·  view source on GitHub ↗
({
  preview,
  className,
  isLoading,
}: PostPreviewProps)

Source from the content-addressed store, hash-verified

23const ParagraphPlaceholder = classed(LoadingPlaceholder, 'w-full h-1.5');
24
25function PostPreview({
26 preview,
27 className,
28 isLoading,
29}: PostPreviewProps): ReactElement {
30 const { url, title, image } = preview ?? {};
31 const imageClassName = 'w-16 laptop:w-24 h-16 rounded-16';
32
33 if (!isLoading && !title) {
34 return null;
35 }
36
37 return (
38 <div
39 className={classNames(
40 'flex w-full items-center gap-4 rounded-12 border border-border-subtlest-tertiary px-4 py-2',
41 className,
42 )}
43 >
44 {isLoading ? (
45 <div className="flex flex-1 flex-col gap-3">
46 <ParagraphPlaceholder />
47 <ParagraphPlaceholder />
48 <ParagraphPlaceholder className="w-1/3" />
49 </div>
50 ) : (
51 <p className="multi-truncate line-clamp-3 flex-1 text-text-secondary typo-caption1">
52 {title}
53 </p>
54 )}
55 {isLoading ? (
56 <LoadingPlaceholder className={imageClassName} />
57 ) : (
58 <Image
59 src={image}
60 alt={title || ''}
61 className={classNames('object-cover', imageClassName)}
62 loading="lazy"
63 fallbackSrc={cloudinaryPostImageCoverPlaceholder}
64 />
65 )}
66 <a
67 href={url}
68 target="_blank"
69 rel="noopener noreferrer"
70 aria-label="Open link"
71 >
72 <OpenLinkIcon
73 size={IconSize.Medium}
74 className={isLoading && 'text-text-disabled'}
75 />
76 </a>
77 </div>
78 );
79}
80
81export default PostPreview;

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected