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

+4 -9
View File
@@ -25,16 +25,16 @@
</script>
<div
class="border rounded-full border-slate-200 dark:border-zinc-800 bg-slate-50 dark:bg-zinc-950 p-1 flex items-center gap-1 w-max max-w-full z-0 relative overflow-auto"
class="flex items-center gap-1 w-max max-w-full z-0 relative overflow-auto"
>
{#each options as option, index}
{@const slctd = selected == option}
<button
class={[
'px-3 py-1 rounded-full text-sm font-medium transition-colors duration-75 relative cursor-pointer',
'px-3 py-1.5 rounded-xl text-sm font-medium transition-colors duration-75 relative cursor-pointer',
slctd
? 'bg-primary-900 dark:bg-primary-100 text-slate-50 dark:text-zinc-900'
: 'dark:bg-zinc-900/50 bg-white',
? 'bg-primary-900 dark:bg-primary-100 text-slate-50 dark:text-zinc-900 hover:brightness-90 active:brightness-75'
: ' border dark:bg-zinc-900/50 bg-white border-slate-300 dark:border-zinc-800 hover:bg-slate-200 hover:dark:bg-zinc-800 active:bg-slate-300 active:dark:bg-zinc-900',
]}
onclick={e => {
e.preventDefault()
@@ -44,11 +44,6 @@
type="button"
>
{optionNames[index] || option}
{#if slctd}
<div
class="absolute left-0 top-0 w-full h-full blur-xl scale-75 opacity-50 dark:bg-primary-100 -z-10"
></div>
{/if}
</button>
{/each}
</div>
@@ -8,7 +8,7 @@
import { placeholders } from '$lib/util.svelte.js'
import type { CommentResponse } from 'lemmy-js-client'
import { Button, Menu, MenuButton, toast } from 'mono-svelte'
import { ArrowUp, Icon, Language, XMark } from 'svelte-hero-icons'
import { Icon, Language, XMark } from 'svelte-hero-icons'
import type { ClassValue, HTMLTextareaAttributes } from 'svelte/elements'
interface Props extends Omit<HTMLTextareaAttributes, 'oncancel'> {
@@ -107,8 +107,8 @@
{#snippet target()}
<Button
size="custom"
class="w-9 h-9"
rounding="pill"
rounding="xl"
class="w-8.5 h-8.5"
color={language != undefined ? 'primary' : 'ghost'}
title={$t('form.profile.languages.title')}
>
@@ -144,11 +144,11 @@
onclick={() => oncancel?.(true)}
color="tertiary"
class="w-8 h-8"
rounding="pill"
rounding="xl"
>
<Icon
src={XMark}
size="20"
size="16"
micro
class="text-slate-600 dark:text-zinc-400"
/>
@@ -156,16 +156,11 @@
<Button
submit
color="primary"
rounding="pill"
size="custom"
class="w-9 h-9"
title={$t('form.submit')}
rounding="xl"
{loading}
disabled={locked || loading || banned}
>
{#snippet prefix()}
<Icon src={ArrowUp} size="18" micro />
{/snippet}
{$t('form.submit')}
</Button>
{/if}
</MarkdownEditor>
@@ -87,7 +87,7 @@
}
</script>
<ul>
<ul class="animate-pop-in">
{#each nodes as node, index (node.comment_view.comment.id)}
<Comment
bind:node={nodes[index]}
@@ -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>
@@ -107,6 +107,7 @@
tools = true,
disabled = false,
rows = 2,
// should be preprocess instead
beforePreview = input => input,
previewing = $bindable(false),
class: clazz = '',
@@ -143,7 +144,7 @@
</Label>
{/if}
<div
class="flex flex-col border border-slate-200 border-b-slate-300 dark:border-t-zinc-700/70 dark:border-zinc-800
class="flex flex-col border border-slate-200 border-b-slate-300 dark:border-zinc-800
focus-within:border-primary-900 dark:focus-within:border-primary-100 focus-within:ring-3 ring-slate-300
dark:ring-zinc-700 rounded-2xl
overflow-hidden transition-colors {clazz}"
@@ -151,7 +152,7 @@ overflow-hidden transition-colors {clazz}"
>
{#if previewing}
<div
class="px-3 py-2.5 overflow-auto text-sm resize-y bg-white dark:bg-zinc-950"
class="p-5 overflow-auto text-sm resize-y bg-white dark:bg-zinc-950 min-h-48"
>
<Markdown source={beforePreview(value)} />
</div>
@@ -75,7 +75,11 @@
background-color: var(--color-zinc-950);
&:hover {
background-color: var(--color-zinc-900);
background-color: color-mix(
in oklab,
var(--color-zinc-925),
var(--color-zinc-900)
);
}
}
@@ -43,7 +43,7 @@
</script>
<nav
class="flex flex-row items-center gap-1 p-1 rounded-full bg-white/60 dark:bg-zinc-800/60
class="flex flex-row items-center gap-1 p-1 rounded-full bg-white/60 dark:bg-zinc-900/60
backdrop-blur-lg border border-slate-200 dark:border-zinc-800 shadow-sm {clazz ??
''}
"
@@ -58,7 +58,7 @@
{route.name}
{#if isSelected(page.url, currentRoute, route.href, defaultRoute)}
<div
class="rounded-full bg-slate-100/60 dark:bg-zinc-700/60
class="rounded-full bg-slate-200/60 dark:bg-zinc-700/60
absolute inset-0 w-full h-full -z-10"
></div>
{/if}
+1 -1
View File
@@ -38,7 +38,7 @@
let {
label = undefined,
value = $bindable(''),
value = $bindable(),
placeholder = '',
disabled = false,
required = false,