fix: tweak alt text in posts
This commit is contained in:
2 files changed
+9
-18
No files matched your search
@@ -78,7 +78,7 @@
|
|||||||
class="absolute bottom-0 left-0 right-0 flex justify-between items-center
|
class="absolute bottom-0 left-0 right-0 flex justify-between items-center
|
||||||
rounded-full ml-auto w-max m-2 p-0 gap-1
|
rounded-full ml-auto w-max m-2 p-0 gap-1
|
||||||
*:bg-white *:border *:border-slate-200 *:dark:border-zinc-800 *:dark:bg-zinc-900"
|
*:bg-white *:border *:border-slate-200 *:dark:border-zinc-800 *:dark:bg-zinc-900"
|
||||||
onclick={stopPropagation(() => {})}
|
onclick={(e) => e.stopPropagation()}
|
||||||
>
|
>
|
||||||
{#if post.alt_text}
|
{#if post.alt_text}
|
||||||
<Button
|
<Button
|
||||||
|
|||||||
@@ -7,9 +7,11 @@
|
|||||||
} from '$lib/components/lemmy/post/helpers.js'
|
} from '$lib/components/lemmy/post/helpers.js'
|
||||||
import { showImage } from '$lib/components/ui/ExpandableImage.svelte'
|
import { showImage } from '$lib/components/ui/ExpandableImage.svelte'
|
||||||
import { settings, type View } from '$lib/settings.svelte.js'
|
import { settings, type View } from '$lib/settings.svelte.js'
|
||||||
|
import { t } from '$lib/translations'
|
||||||
import { isImage } from '$lib/ui/image'
|
import { isImage } from '$lib/ui/image'
|
||||||
import type { Post } from 'lemmy-js-client'
|
import type { Post } from 'lemmy-js-client'
|
||||||
import { Material, Popover } from 'mono-svelte'
|
import { Material, modal, Popover } from 'mono-svelte'
|
||||||
|
import Button from 'mono-svelte/button/Button.svelte'
|
||||||
import {
|
import {
|
||||||
DocumentText,
|
DocumentText,
|
||||||
Icon,
|
Icon,
|
||||||
@@ -48,24 +50,13 @@
|
|||||||
-->
|
-->
|
||||||
<div class="{size} relative group/media {clazz ?? ''}" {style}>
|
<div class="{size} relative group/media {clazz ?? ''}" {style}>
|
||||||
{#if post.alt_text}
|
{#if post.alt_text}
|
||||||
<Popover
|
<Button
|
||||||
openOnHover
|
rounding="pill"
|
||||||
placement={settings.leftAlign ? 'bottom-start' : 'bottom-end'}
|
|
||||||
>
|
|
||||||
{#snippet target()}
|
|
||||||
<Material
|
|
||||||
padding="none"
|
|
||||||
rounding="full"
|
|
||||||
elevation="high"
|
|
||||||
class="w-max absolute bottom-0 left-0 py-0.5 px-1.5 m-1 font-bold"
|
class="w-max absolute bottom-0 left-0 py-0.5 px-1.5 m-1 font-bold"
|
||||||
|
onclick={() => modal({ title: 'Alt', body: post.alt_text ?? '' })}
|
||||||
>
|
>
|
||||||
ALT
|
ALT
|
||||||
</Material>
|
</Button>
|
||||||
{/snippet}
|
|
||||||
<div class="max-w-sm">
|
|
||||||
{post.alt_text}
|
|
||||||
</div>
|
|
||||||
</Popover>
|
|
||||||
{/if}
|
{/if}
|
||||||
<svelte:element
|
<svelte:element
|
||||||
this={!settings.expandImages || type != 'image' ? 'a' : 'button'}
|
this={!settings.expandImages || type != 'image' ? 'a' : 'button'}
|
||||||
@@ -86,7 +77,7 @@
|
|||||||
loading="lazy"
|
loading="lazy"
|
||||||
class="object-cover relative overflow-hidden bg-slate-100 dark:bg-zinc-800 rounded-xl
|
class="object-cover relative overflow-hidden bg-slate-100 dark:bg-zinc-800 rounded-xl
|
||||||
transition-colors {size}"
|
transition-colors {size}"
|
||||||
alt={post.name}
|
alt={post.alt_text ?? ' '}
|
||||||
class:blur-xl={blur}
|
class:blur-xl={blur}
|
||||||
/>
|
/>
|
||||||
{#if type != 'image'}
|
{#if type != 'image'}
|
||||||
|
|||||||
Reference in new issue
Block a user