design: improve animation and consistency
This commit is contained in:
12 files changed
+90
-43
No files matched your search
@@ -25,16 +25,16 @@
|
|||||||
</script>
|
</script>
|
||||||
|
|
||||||
<div
|
<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}
|
{#each options as option, index}
|
||||||
{@const slctd = selected == option}
|
{@const slctd = selected == option}
|
||||||
<button
|
<button
|
||||||
class={[
|
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
|
slctd
|
||||||
? 'bg-primary-900 dark:bg-primary-100 text-slate-50 dark:text-zinc-900'
|
? 'bg-primary-900 dark:bg-primary-100 text-slate-50 dark:text-zinc-900 hover:brightness-90 active:brightness-75'
|
||||||
: 'dark:bg-zinc-900/50 bg-white',
|
: ' 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 => {
|
onclick={e => {
|
||||||
e.preventDefault()
|
e.preventDefault()
|
||||||
@@ -44,11 +44,6 @@
|
|||||||
type="button"
|
type="button"
|
||||||
>
|
>
|
||||||
{optionNames[index] || option}
|
{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>
|
</button>
|
||||||
{/each}
|
{/each}
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -8,7 +8,7 @@
|
|||||||
import { placeholders } from '$lib/util.svelte.js'
|
import { placeholders } from '$lib/util.svelte.js'
|
||||||
import type { CommentResponse } from 'lemmy-js-client'
|
import type { CommentResponse } from 'lemmy-js-client'
|
||||||
import { Button, Menu, MenuButton, toast } from 'mono-svelte'
|
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'
|
import type { ClassValue, HTMLTextareaAttributes } from 'svelte/elements'
|
||||||
|
|
||||||
interface Props extends Omit<HTMLTextareaAttributes, 'oncancel'> {
|
interface Props extends Omit<HTMLTextareaAttributes, 'oncancel'> {
|
||||||
@@ -107,8 +107,8 @@
|
|||||||
{#snippet target()}
|
{#snippet target()}
|
||||||
<Button
|
<Button
|
||||||
size="custom"
|
size="custom"
|
||||||
class="w-9 h-9"
|
rounding="xl"
|
||||||
rounding="pill"
|
class="w-8.5 h-8.5"
|
||||||
color={language != undefined ? 'primary' : 'ghost'}
|
color={language != undefined ? 'primary' : 'ghost'}
|
||||||
title={$t('form.profile.languages.title')}
|
title={$t('form.profile.languages.title')}
|
||||||
>
|
>
|
||||||
@@ -144,11 +144,11 @@
|
|||||||
onclick={() => oncancel?.(true)}
|
onclick={() => oncancel?.(true)}
|
||||||
color="tertiary"
|
color="tertiary"
|
||||||
class="w-8 h-8"
|
class="w-8 h-8"
|
||||||
rounding="pill"
|
rounding="xl"
|
||||||
>
|
>
|
||||||
<Icon
|
<Icon
|
||||||
src={XMark}
|
src={XMark}
|
||||||
size="20"
|
size="16"
|
||||||
micro
|
micro
|
||||||
class="text-slate-600 dark:text-zinc-400"
|
class="text-slate-600 dark:text-zinc-400"
|
||||||
/>
|
/>
|
||||||
@@ -156,16 +156,11 @@
|
|||||||
<Button
|
<Button
|
||||||
submit
|
submit
|
||||||
color="primary"
|
color="primary"
|
||||||
rounding="pill"
|
rounding="xl"
|
||||||
size="custom"
|
|
||||||
class="w-9 h-9"
|
|
||||||
title={$t('form.submit')}
|
|
||||||
{loading}
|
{loading}
|
||||||
disabled={locked || loading || banned}
|
disabled={locked || loading || banned}
|
||||||
>
|
>
|
||||||
{#snippet prefix()}
|
{$t('form.submit')}
|
||||||
<Icon src={ArrowUp} size="18" micro />
|
|
||||||
{/snippet}
|
|
||||||
</Button>
|
</Button>
|
||||||
{/if}
|
{/if}
|
||||||
</MarkdownEditor>
|
</MarkdownEditor>
|
||||||
|
|||||||
@@ -87,7 +87,7 @@
|
|||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<ul>
|
<ul class="animate-pop-in">
|
||||||
{#each nodes as node, index (node.comment_view.comment.id)}
|
{#each nodes as node, index (node.comment_view.comment.id)}
|
||||||
<Comment
|
<Comment
|
||||||
bind:node={nodes[index]}
|
bind:node={nodes[index]}
|
||||||
|
|||||||
@@ -1,6 +1,4 @@
|
|||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import { preventDefault, run } from 'svelte/legacy'
|
|
||||||
|
|
||||||
import { profile } from '$lib/auth.svelte.js'
|
import { profile } from '$lib/auth.svelte.js'
|
||||||
import ErrorContainer, {
|
import ErrorContainer, {
|
||||||
clearErrorScope,
|
clearErrorScope,
|
||||||
@@ -19,9 +17,11 @@
|
|||||||
import type { Community, Post, PostView } from 'lemmy-js-client'
|
import type { Community, Post, PostView } from 'lemmy-js-client'
|
||||||
import {
|
import {
|
||||||
Button,
|
Button,
|
||||||
|
Modal,
|
||||||
Select,
|
Select,
|
||||||
Spinner,
|
Spinner,
|
||||||
Switch,
|
Switch,
|
||||||
|
TextArea,
|
||||||
TextInput,
|
TextInput,
|
||||||
toast,
|
toast,
|
||||||
} from 'mono-svelte'
|
} from 'mono-svelte'
|
||||||
@@ -245,7 +245,7 @@
|
|||||||
|
|
||||||
let addAltText = $state(false)
|
let addAltText = $state(false)
|
||||||
|
|
||||||
run(() => {
|
$effect(() => {
|
||||||
generation.generatable = canGenerateTitle(data.url)
|
generation.generatable = canGenerateTitle(data.url)
|
||||||
})
|
})
|
||||||
</script>
|
</script>
|
||||||
@@ -263,7 +263,30 @@
|
|||||||
{/await}
|
{/await}
|
||||||
{/if}
|
{/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}
|
{#if formtitle}{@render formtitle()}{:else}
|
||||||
<Header class="font-bold text-xl">
|
<Header class="font-bold text-xl">
|
||||||
{edit ? $t('form.post.edit') : $t('form.post.create')}
|
{edit ? $t('form.post.edit') : $t('form.post.create')}
|
||||||
@@ -340,7 +363,7 @@
|
|||||||
/>
|
/>
|
||||||
<div class="flex items-center gap-2 actions">
|
<div class="flex items-center gap-2 actions">
|
||||||
<div
|
<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 />
|
<Icon src={Plus} size="16" micro />
|
||||||
</div>
|
</div>
|
||||||
@@ -349,7 +372,7 @@
|
|||||||
onclick={() => (addAltText = !addAltText)}
|
onclick={() => (addAltText = !addAltText)}
|
||||||
rounding="pill"
|
rounding="pill"
|
||||||
size="sm"
|
size="sm"
|
||||||
color="ghost"
|
color={data.alt_text ? 'primary' : 'ghost'}
|
||||||
class="text-xs"
|
class="text-xs"
|
||||||
>
|
>
|
||||||
{#snippet prefix()}
|
{#snippet prefix()}
|
||||||
|
|||||||
@@ -68,9 +68,9 @@
|
|||||||
>
|
>
|
||||||
<div
|
<div
|
||||||
class={[
|
class={[
|
||||||
'relative overflow-hidden rounded-2xl max-h-full',
|
'relative overflow-hidden rounded-2xl max-h-full h-full',
|
||||||
'p-1 h-full',
|
|
||||||
'border border-slate-200 dark:border-zinc-800 hover:border-slate-300 dark:hover:border-zinc-700',
|
'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)}
|
{#if post.thumbnail_url || isImage(post.url)}
|
||||||
@@ -155,3 +155,18 @@
|
|||||||
{/if}
|
{/if}
|
||||||
</svelte:element>
|
</svelte:element>
|
||||||
</div>
|
</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,
|
tools = true,
|
||||||
disabled = false,
|
disabled = false,
|
||||||
rows = 2,
|
rows = 2,
|
||||||
|
// should be preprocess instead
|
||||||
beforePreview = input => input,
|
beforePreview = input => input,
|
||||||
previewing = $bindable(false),
|
previewing = $bindable(false),
|
||||||
class: clazz = '',
|
class: clazz = '',
|
||||||
@@ -143,7 +144,7 @@
|
|||||||
</Label>
|
</Label>
|
||||||
{/if}
|
{/if}
|
||||||
<div
|
<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
|
focus-within:border-primary-900 dark:focus-within:border-primary-100 focus-within:ring-3 ring-slate-300
|
||||||
dark:ring-zinc-700 rounded-2xl
|
dark:ring-zinc-700 rounded-2xl
|
||||||
overflow-hidden transition-colors {clazz}"
|
overflow-hidden transition-colors {clazz}"
|
||||||
@@ -151,7 +152,7 @@ overflow-hidden transition-colors {clazz}"
|
|||||||
>
|
>
|
||||||
{#if previewing}
|
{#if previewing}
|
||||||
<div
|
<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)} />
|
<Markdown source={beforePreview(value)} />
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -75,7 +75,11 @@
|
|||||||
background-color: var(--color-zinc-950);
|
background-color: var(--color-zinc-950);
|
||||||
|
|
||||||
&:hover {
|
&: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>
|
</script>
|
||||||
|
|
||||||
<nav
|
<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 ??
|
backdrop-blur-lg border border-slate-200 dark:border-zinc-800 shadow-sm {clazz ??
|
||||||
''}
|
''}
|
||||||
"
|
"
|
||||||
@@ -58,7 +58,7 @@
|
|||||||
{route.name}
|
{route.name}
|
||||||
{#if isSelected(page.url, currentRoute, route.href, defaultRoute)}
|
{#if isSelected(page.url, currentRoute, route.href, defaultRoute)}
|
||||||
<div
|
<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"
|
absolute inset-0 w-full h-full -z-10"
|
||||||
></div>
|
></div>
|
||||||
{/if}
|
{/if}
|
||||||
|
|||||||
@@ -38,7 +38,7 @@
|
|||||||
|
|
||||||
let {
|
let {
|
||||||
label = undefined,
|
label = undefined,
|
||||||
value = $bindable(''),
|
value = $bindable(),
|
||||||
placeholder = '',
|
placeholder = '',
|
||||||
disabled = false,
|
disabled = false,
|
||||||
required = false,
|
required = false,
|
||||||
|
|||||||
@@ -74,9 +74,20 @@
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
let nprogressTimeout = -1
|
||||||
$effect(() => {
|
$effect(() => {
|
||||||
if (navigating.to) nProgress.start()
|
if (navigating.to)
|
||||||
else nProgress.done()
|
nprogressTimeout = setTimeout(
|
||||||
|
() => nProgress.start(),
|
||||||
|
200,
|
||||||
|
) as unknown as number
|
||||||
|
else {
|
||||||
|
if (nprogressTimeout > -1) {
|
||||||
|
clearTimeout(nprogressTimeout)
|
||||||
|
nprogressTimeout = -1
|
||||||
|
nProgress.done()
|
||||||
|
}
|
||||||
|
}
|
||||||
})
|
})
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
|||||||
@@ -127,7 +127,7 @@
|
|||||||
{/if}
|
{/if}
|
||||||
</svelte:head>
|
</svelte:head>
|
||||||
|
|
||||||
<article class="flex flex-col gap-2">
|
<article class="flex flex-col gap-2 animate-pop-in">
|
||||||
<header class="flex flex-col gap-2">
|
<header class="flex flex-col gap-2">
|
||||||
<div class="flex flex-row justify-between items-center gap-2 flex-wrap">
|
<div class="flex flex-row justify-between items-center gap-2 flex-wrap">
|
||||||
<PostMeta
|
<PostMeta
|
||||||
|
|||||||
+7
-4
@@ -11,7 +11,7 @@
|
|||||||
--font-display: Inter, system-ui, sans-serif;
|
--font-display: Inter, system-ui, sans-serif;
|
||||||
--font-mono: monospace;
|
--font-mono: monospace;
|
||||||
|
|
||||||
--animate-pop-in: pop-in 0.25s ease-out forwards;
|
--animate-pop-in: pop-in 0.8s cubic-bezier(0.075, 0.82, 0.165, 1) forwards;
|
||||||
|
|
||||||
--ease-cubic: cubic-bezier(0.075, 0.82, 0.165, 1);
|
--ease-cubic: cubic-bezier(0.075, 0.82, 0.165, 1);
|
||||||
--spacing-22: 88px;
|
--spacing-22: 88px;
|
||||||
@@ -49,11 +49,14 @@
|
|||||||
--color-white: rgb(var(--c-o-white, 255 255 255));
|
--color-white: rgb(var(--c-o-white, 255 255 255));
|
||||||
|
|
||||||
@keyframes pop-in {
|
@keyframes pop-in {
|
||||||
0%,
|
0% {
|
||||||
100% {
|
transform: translateY(16px);
|
||||||
transform: translateX(8px);
|
|
||||||
opacity: 0;
|
opacity: 0;
|
||||||
}
|
}
|
||||||
|
100% {
|
||||||
|
transform: translateY(0px);
|
||||||
|
opacity: 1;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in new issue
Block a user