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>
+4 -4
View File
@@ -1,8 +1,8 @@
<script lang="ts">
import { tick } from 'svelte'
import type { HTMLAttributes } from 'svelte/elements'
import type { ClassValue, HTMLTextareaAttributes } from 'svelte/elements'
let textarea: HTMLTextAreaElement | undefined = $state()
let textarea = $state<HTMLTextAreaElement>()
async function adjustHeight() {
await tick()
@@ -11,11 +11,11 @@
textarea.style.height = `${textarea.scrollHeight}px` // Set height to the scrollHeight
}
}
interface Props extends HTMLAttributes<HTMLTextAreaElement> {
interface Props extends HTMLTextareaAttributes {
label?: string | undefined
value: string
required?: boolean
class?: string
class?: ClassValue
}
let {
+1 -1
View File
@@ -127,7 +127,7 @@
@variant md {
width: max-content;
height: max-content;
padding: calc(var(--spacing) * 1.25) calc(var(--spacing) * 3);
padding: calc(var(--spacing) * 1.125) calc(var(--spacing) * 3);
@variant hover {
background-color: --alpha(var(--color-slate-200) / 50%);
+8 -2
View File
@@ -106,7 +106,7 @@
size = 'md',
rounding = size == 'lg' || size == 'square-lg' ? '2xl' : 'xl',
alignment = 'center',
shadow = color == 'primary' || color == 'secondary' ? 'sm' : 'none',
shadow = 'none',
gap = 'md',
disabled,
loaderWidth = undefined,
@@ -230,8 +230,14 @@
background-color: var(--color-white);
@variant dark {
border: 1px solid var(--color-zinc-800);
border: 1px solid
color-mix(
in oklab,
var(--color-zinc-800) 50%,
var(--color-zinc-900) 50%
);
background-color: var(--color-zinc-900);
border-top-color: var(--color-zinc-800);
}
@variant hover {
+9 -6
View File
@@ -29,7 +29,6 @@
<style>
.btn-group {
gap: var(--spacing);
flex-shrink: 0;
}
@@ -41,14 +40,18 @@
& > button,
& > a {
position: relative;
border-radius: 8px !important;
&:first-child {
border-radius: 24px 12px 12px 24px !important;
&:not(:first-child):not(:last-child) {
border-radius: 0px !important;
}
&:last-child {
border-radius: 12px 24px 24px 12px !important;
&:first-child:not(:last-child) {
border-radius: var(--radius-xl) 0px 0px var(--radius-xl) !important;
border-right: 0px;
}
&:last-child:not(:first-child) {
border-radius: 0px var(--radius-xl) var(--radius-xl) 0px !important;
}
}
}
+1 -1
View File
@@ -95,7 +95,7 @@
bind:this={element}
class={[
buttonSize[size],
'btn btn-secondary select rounded-xl appearance-none pr-6! w-full shadow-xs',
'btn btn-secondary select rounded-xl appearance-none pr-6! w-full',
selectClass,
clazz,
]}
+8 -3
View File
@@ -115,13 +115,18 @@
border-top-color: var(--color-zinc-700);
@variant hover {
@variant dark {
background-color: var(--color-zinc-925);
}
background-color: var(--color-zinc-925);
}
@variant active {
background-color: var(--color-zinc-950);
}
}
@variant hover {
background-color: var(--color-slate-50);
}
@variant active {
background-color: var(--color-slate-100);
}
}