design: improve animation and consistency

This commit is contained in:
James Xylight committed 2025-08-12 15:20:12 -07:00
1 parent e1018828fa
commit 2d641ead1f
12 files changed
+90 -43

No files matched your search

@@ -1,6 +1,4 @@
<script lang="ts">
import { preventDefault, run } from 'svelte/legacy'
import { profile } from '$lib/auth.svelte.js'
import ErrorContainer, {
clearErrorScope,
@@ -19,9 +17,11 @@
import type { Community, Post, PostView } from 'lemmy-js-client'
import {
Button,
Modal,
Select,
Spinner,
Switch,
TextArea,
TextInput,
toast,
} from 'mono-svelte'
@@ -245,7 +245,7 @@
let addAltText = $state(false)
run(() => {
$effect(() => {
generation.generatable = canGenerateTitle(data.url)
})
</script>
@@ -263,7 +263,30 @@
{/await}
{/if}
<form onsubmit={preventDefault(submit)} class="flex flex-col gap-4 h-full">
{#if addAltText}
<Modal title={$t('form.post.altText')} bind:open={addAltText}>
<form
onsubmit={e => {
e.preventDefault()
addAltText = !addAltText
}}
class="space-y-4 w-full"
>
<TextArea bind:value={data.alt_text} />
<Button size="lg" submit class="w-full">
{$t('common.back')}
</Button>
</form>
</Modal>
{/if}
<form
onsubmit={e => {
e.preventDefault()
submit()
}}
class="flex flex-col gap-4 h-full"
>
{#if formtitle}{@render formtitle()}{:else}
<Header class="font-bold text-xl">
{edit ? $t('form.post.edit') : $t('form.post.create')}
@@ -340,7 +363,7 @@
/>
<div class="flex items-center gap-2 actions">
<div
class="border border-slate-100 dark:border-zinc-800 dark:text-zinc-400 text-slate-600 rounded-xl h-6 w-6 grid place-items-center"
class="border border-slate-100 dark:border-zinc-800 dark:text-zinc-400 text-slate-600 rounded-xl h-7 w-7 grid place-items-center"
>
<Icon src={Plus} size="16" micro />
</div>
@@ -349,7 +372,7 @@
onclick={() => (addAltText = !addAltText)}
rounding="pill"
size="sm"
color="ghost"
color={data.alt_text ? 'primary' : 'ghost'}
class="text-xs"
>
{#snippet prefix()}
@@ -68,9 +68,9 @@
>
<div
class={[
'relative overflow-hidden rounded-2xl max-h-full',
'p-1 h-full',
'relative overflow-hidden rounded-2xl max-h-full h-full',
'border border-slate-200 dark:border-zinc-800 hover:border-slate-300 dark:hover:border-zinc-700',
'dark:bg-zinc-800 hover-scale-effect',
]}
>
{#if post.thumbnail_url || isImage(post.url)}
@@ -155,3 +155,18 @@
{/if}
</svelte:element>
</div>
<style>
.hover-scale-effect > *,
.hover-scale-effect > picture > img {
transition: transform 200ms var(--ease-cubic);
}
.hover-scale-effect:hover > *,
.hover-scale-effect:hover > picture > img {
transform: scale(95%);
}
.hover-scale-effect:active > *,
.hover-scale-effect:active > picture > img {
transform: scale(90%);
}
</style>