···
const PostImage: React.FC<PostImageProps> = ({ image, did }) => {
534
+
const [showAltText, setShowAltText] = React.useState(false);
const imageBlob = image.image;
const cdnUrl = isBlobWithCdn(imageBlob) ? imageBlob.cdnUrl : undefined;
const cid = cdnUrl ? undefined : extractCidFromBlob(imageBlob);
const { url: urlFromBlob, loading, error } = useBlob(did, cid);
const url = cdnUrl || urlFromBlob;
const alt = image.alt?.trim() || "Bluesky attachment";
541
+
const hasAlt = image.alt && image.alt.trim().length > 0;
image.aspectRatio && image.aspectRatio.height > 0
···
580
+
onClick={() => setShowAltText(!showAltText)}
582
+
...imagesBase.altBadge,
583
+
background: showAltText
584
+
? `var(--atproto-color-text)`
585
+
: `var(--atproto-color-bg-secondary)`,
587
+
? `var(--atproto-color-bg)`
588
+
: `var(--atproto-color-text)`,
590
+
title="Toggle alt text"
591
+
aria-label="Toggle alt text"
577
-
{image.alt && image.alt.trim().length > 0 && (
597
+
{hasAlt && showAltText && (
···
644
+
} satisfies React.CSSProperties,
646
+
position: "absolute",
649
+
padding: "4px 8px",
652
+
letterSpacing: "0.5px",
656
+
transition: "background 150ms ease, color 150ms ease",
657
+
fontFamily: "system-ui, sans-serif",
} satisfies React.CSSProperties,