design: improve click response and visual coherency

This commit is contained in:
Xylight committed 2026-02-12 19:12:07 -08:00
1 parent 16bcd76bd0
commit f77740b5cb
12 files changed
+117 -83

No files matched your search

+18 -15
View File
@@ -2,7 +2,7 @@
import type { View } from '$lib/app/settings.svelte'
import { parseURL } from '$lib/ui/form/Link.svelte'
import { Material } from 'mono-svelte'
import { ArrowTopRightOnSquare, Icon, Link } from 'svelte-hero-icons/dist'
import { Icon, Link } from 'svelte-hero-icons/dist'
import { optimizeImageURL } from './helpers'
interface Props {
@@ -10,6 +10,7 @@
thumbnail_url?: string
nsfw?: boolean
embed_title?: string
embed_body?: string
view?: View
}
@@ -18,6 +19,7 @@
thumbnail_url,
nsfw = false,
embed_title,
embed_body,
view = 'cozy',
}: Props = $props()
@@ -34,7 +36,7 @@
class={[
'post-link group/link hover:bg-slate-50 hover:dark:bg-zinc-800 transition-colors',
]}
rounding="xl"
rounding="2xl"
element="a"
padding="none"
href={url}
@@ -48,6 +50,11 @@
</div>
{/if}
<p class="post-link-title">{embed_title}</p>
{#if embed_body}
<p class="post-link-body">
{embed_body?.slice(0, 200)}{#if embed_body.length >= 200}...{/if}
</p>
{/if}
</div>
{#if thumbnail_url}
<div class="post-link-image">
@@ -76,19 +83,6 @@
class:blur-3xl={nsfw}
/>
</picture>
<Material
padding="xs"
color="uniform"
class="absolute top-0 right-0 m-2 z-50"
role="presentation"
>
<Icon
src={ArrowTopRightOnSquare}
size="16"
micro
class="text-slate-500 dark:text-zinc-300"
/>
</Material>
</div>
{/if}
</Material>
@@ -154,6 +148,15 @@
max-width: calc(var(--spacing) * 108);
}
.post-link-body {
color: var(--color-slate-500);
overflow: hidden;
max-height: 100%;
@variant dark {
color: var(--color-zinc-500);
}
}
.post-link-image {
flex-shrink: 0;
margin-bottom: auto;
+4 -5
View File
@@ -94,7 +94,6 @@
onclick={() => castVote(vote == targetNum ? 0 : targetNum)}
class={[
'flex items-center gap-0.5 transition-colors relative cursor-pointer h-full p-2',
'first:rounded-l-[inherit] last:rounded-r-[inherit]',
'last:flex-row-reverse',
vote == targetNum
? shouldShowVoteColor(
@@ -138,7 +137,7 @@
<div
class={[
buttonColor.secondary,
'rounded-xl h-full font-medium flex relative hover:bg-transparent! shadow-xs',
'rounded-xl h-full font-medium flex relative hover:bg-transparent! overflow-hidden',
voteRatio < 85 && settings.voteRatioBar && 'vote-ratio',
]}
aria-label={$t('aria.vote.group')}
@@ -160,7 +159,7 @@
}
.vote-ratio::before {
border-radius: var(--radius-3xl);
border-radius: inherit;
content: '';
position: absolute;
height: 100%;
@@ -171,8 +170,8 @@
z-index: -10;
background: linear-gradient(
to right,
var(--color-indigo-500) calc(var(--vote-ratio) - 4%),
var(--color-red-500) calc(var(--vote-ratio) + 4%)
var(--color-indigo-400) calc(var(--vote-ratio) - 2%),
var(--color-red-400) calc(var(--vote-ratio) + 2%)
);
}
</style>
+2 -1
View File
@@ -25,7 +25,7 @@
}: Props = $props()
</script>
<!--
<!--
@component
This component will show either
- A media item (pictures, videos) (large form factor posts only)
@@ -52,6 +52,7 @@
thumbnail_url={post.thumbnail_url}
nsfw={post.nsfw}
embed_title={post.embed_title}
embed_body={post.embed_description}
{view}
{...rest}
/>
@@ -40,7 +40,7 @@
let size = $derived(thumbnailSize(view))
</script>
<!--
<!--
@component
Thumbnails for compact and list view posts.
-->
@@ -61,12 +61,12 @@
<div
class={[
'relative overflow-hidden rounded-2xl max-h-full h-full',
'border border-slate-200 dark:border-zinc-800 hover-scale-effect bg-slate-200 dark:bg-zinc-800',
'border border-slate-200 dark:border-zinc-800 hover-scale-effect bg-slate-200 dark:bg-zinc-900',
]}
>
{#if post.thumbnail_url || type == 'image'}
{@const thumbnail = post.thumbnail_url != undefined && type != 'image'}
<picture>
<picture class="rounded-[inherit]">
<!--I would add AVIF, but lemmy.world's AVIF is broken as of currently-->
{#each ['webp'] as format}
<source
@@ -94,7 +94,7 @@
src={blur ? '' : bestImageURL(post, thumbnail, -1, null)}
loading="lazy"
class={[
'object-cover relative overflow-hidden rounded-xl h-full',
'object-cover relative overflow-hidden rounded-[inherit] h-full',
size,
]}
alt={post.alt_text ?? ' '}
@@ -102,11 +102,7 @@
/>
</picture>
{#if type != 'image'}
<div
class={[
'absolute w-8 h-8 bottom-1 left-1 rounded-xl bg-slate-25 dark:bg-zinc-900 grid place-items-center',
]}
>
<div class="post-media-indicator">
<Icon src={type == 'iframe' ? VideoCamera : Link} micro size="16" />
</div>
{/if}
@@ -150,6 +146,7 @@
</div>
<style>
@reference '../../../../app.css';
.hover-scale-effect > *,
.hover-scale-effect > picture > img {
transition: transform 200ms var(--ease-cubic);
@@ -162,4 +159,30 @@
.hover-scale-effect:active > picture > img {
transform: scale(90%);
}
.post-media-indicator {
/*bg-linear-180 from-zinc-900/0 to-zinc-900/95 h-16 absolute bottom-0 w-full left-0 flex items-end p-2*/
position: absolute;
bottom: 0;
left: 0;
display: flex;
align-items: end;
padding: calc(var(--spacing) * 2);
height: calc(var(--spacing) * 16);
width: 100%;
background-image: linear-gradient(
to bottom,
--alpha(var(--color-slate-50) / 0%),
--alpha(var(--color-slate-50) / 95%)
);
@variant dark {
background-image: linear-gradient(
to bottom,
--alpha(var(--color-zinc-900) / 0%),
--alpha(var(--color-zinc-900) / 95%)
);
}
}
</style>