design: improve animation and consistency
This commit is contained in:
12 files changed
+90
-43
No files matched your search
@@ -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>
|
||||
Reference in new issue
Block a user