Blur conversation images by default

This commit is contained in:
jjbrunton committed 2026-08-09 07:55:51 +01:00
1 parent 5c01d7d9aa
commit e7c29f91f2
5 files changed
+60 -31

No files matched your search

+14 -5
View File
@@ -8,15 +8,24 @@ export interface OriginPost {
}
export function OriginPostCard({ post }: { post: OriginPost }) {
const [isImageRevealed, setIsImageRevealed] = useState(false);
return (
<a aria-label={post.title} className="origin-post-card" href={post.url} rel="noreferrer" target="_blank">
{post.imageUrl ? <img alt={`Source post: ${post.title}`} loading="lazy" src={post.imageUrl} /> : null}
<span>
<div className="origin-post-card">
{post.imageUrl ? (
<div className="origin-post-image">
<img alt={`Source post: ${post.title}`} className={isImageRevealed ? undefined : 'is-blurred'} loading="lazy" src={post.imageUrl} />
<button aria-pressed={isImageRevealed} onClick={() => setIsImageRevealed((current) => !current)} type="button">
{isImageRevealed ? 'Blur original image' : 'Reveal original image'}
</button>
</div>
) : null}
<a aria-label={post.title} className="origin-post-copy" href={post.url} rel="noreferrer" target="_blank">
<small>Started from {post.subreddit ? `r/${post.subreddit}` : 'Reddit'}</small>
<strong>{post.title}</strong>
<span>Open original post</span>
</span>
</a>
</a>
</div>
);
}