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

Function PostImage

packages/shared/src/components/post/PostImage.tsx:15–50  ·  view source on GitHub ↗
({
  src,
  alt = 'Post cover image',
  className,
  loading = 'lazy',
  fetchPriority,
}: PostImageProps)

Source from the content-addressed store, hash-verified

13}
14
15export function PostImage({
16 src,
17 alt = 'Post cover image',
18 className,
19 loading = 'lazy',
20 fetchPriority,
21}: PostImageProps): ReactElement | null {
22 const openImage = useImageViewer();
23
24 if (!src || isPlaceholderImage(src)) {
25 return null;
26 }
27
28 return (
29 <button
30 type="button"
31 aria-label="Open image"
32 className={classNames(
33 'block w-fit max-w-full cursor-zoom-in overflow-hidden rounded-12 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent-cabbage-default',
34 className,
35 )}
36 onClick={(event) => {
37 event.stopPropagation();
38 openImage(src, alt, event.currentTarget);
39 }}
40 >
41 <Image
42 src={src}
43 alt={alt}
44 loading={loading}
45 fetchPriority={fetchPriority}
46 className="block h-auto max-h-img-mobile w-auto max-w-full object-contain tablet:max-h-img-desktop"
47 />
48 </button>
49 );
50}

Callers

nothing calls this directly

Calls 2

useImageViewerFunction · 0.90
isPlaceholderImageFunction · 0.90

Tested by

no test coverage detected