Blur conversation images by default
This commit is contained in:
1 parent
5c01d7d9aa
commit
e7c29f91f2
5 files changed
+60
-31
No files matched your search
@@ -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>
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user