design: improve click response and visual coherency
This commit is contained in:
12 files changed
+117
-83
No files matched your search
@@ -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;
|
||||
|
||||
@@ -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>
|
||||
@@ -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>
|
||||
@@ -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 {
|
||||
|
||||
@@ -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%);
|
||||
|
||||
@@ -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 {
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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,
|
||||
]}
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -22,10 +22,16 @@
|
||||
pushError,
|
||||
} from '$lib/ui/info/ErrorContainer.svelte'
|
||||
import { Header } from '$lib/ui/layout'
|
||||
import { Button, Note, Spinner, TextInput, toast } from 'mono-svelte'
|
||||
import {
|
||||
Button,
|
||||
ButtonGroup,
|
||||
Note,
|
||||
Spinner,
|
||||
TextInput,
|
||||
toast,
|
||||
} from 'mono-svelte'
|
||||
import { debounce } from 'mono-svelte/util/time'
|
||||
import {
|
||||
Icon,
|
||||
Identification,
|
||||
QuestionMarkCircle,
|
||||
UserCircle,
|
||||
@@ -236,21 +242,18 @@
|
||||
{$t('account.login')}
|
||||
</Button>
|
||||
<hr class="border-slate-200 dark:border-zinc-800" />
|
||||
<div class="flex flex-row items-center gap-2 overflow-auto *:shrink-0">
|
||||
<Button rounding="pill" color="ghost" href="/signup">
|
||||
<Icon src={Identification} mini size="16" />
|
||||
<ButtonGroup orientation="horizontal" class="flex overflow-auto">
|
||||
<Button href="/signup" icon={Identification}>
|
||||
{$t('account.signup')}
|
||||
</Button>
|
||||
<Button rounding="pill" color="ghost" href="/login_reset">
|
||||
<Icon src={QuestionMarkCircle} mini size="16" />
|
||||
<Button href="/login_reset" icon={QuestionMarkCircle}>
|
||||
{$t('form.forgotpassword')}
|
||||
</Button>
|
||||
{#if !LINKED_INSTANCE_URL}
|
||||
<Button rounding="pill" color="ghost" href="/login/guest">
|
||||
<Icon src={UserCircle} mini size="16" />
|
||||
<Button href="/login/guest" icon={UserCircle}>
|
||||
{$t('account.guest')}
|
||||
</Button>
|
||||
{/if}
|
||||
</div>
|
||||
</ButtonGroup>
|
||||
</form>
|
||||
</div>
|
||||
@@ -1,7 +1,8 @@
|
||||
<script lang="ts">
|
||||
import { t } from '$lib/app/i18n'
|
||||
import { type Theme, theme as themeData } from '$lib/app/theme/theme.svelte'
|
||||
import { action, Button, Material, modal, TextInput } from 'mono-svelte'
|
||||
import FreeTextInput from '$lib/ui/form/FreeTextInput.svelte'
|
||||
import { action, Button, Material, modal } from 'mono-svelte'
|
||||
import { CheckCircle, Icon, Trash } from 'svelte-hero-icons/dist'
|
||||
|
||||
interface Props {
|
||||
@@ -10,6 +11,7 @@
|
||||
|
||||
let { theme = $bindable() }: Props = $props()
|
||||
|
||||
let selected = $derived(theme.id == themeData.data.currentTheme)
|
||||
let editingName = $state(false)
|
||||
</script>
|
||||
|
||||
@@ -17,14 +19,13 @@
|
||||
<Material
|
||||
padding="none"
|
||||
rounding="none"
|
||||
class="{theme.id == themeData.data.currentTheme
|
||||
? 'ring-2 ring-primary-900 dark:ring-primary-100'
|
||||
: ''} rounded-2xl flex relative cursor-pointer h-full flex-col text-left p-0.5"
|
||||
color="default"
|
||||
class={[
|
||||
'rounded-2xl flex relative cursor-pointer h-full flex-col text-left p-0.5',
|
||||
]}
|
||||
>
|
||||
<div
|
||||
class={[
|
||||
'h-20 w-full rounded-2xl rounded-b-none flex flex-row flex-wrap p-3 gap-2',
|
||||
]}
|
||||
class={['h-20 w-full rounded-xl flex flex-row flex-wrap p-3 gap-2']}
|
||||
style="background-color: rgb({theme.colors[
|
||||
'zinc'
|
||||
][900]}); color: rgb({theme.colors['zinc'][50]});"
|
||||
@@ -46,25 +47,15 @@
|
||||
/>
|
||||
{/if}
|
||||
<div class="px-4 py-2 flex items-center gap-1 justify-between">
|
||||
{#if editingName}
|
||||
<form
|
||||
onsubmit={(e) => {
|
||||
e.preventDefault()
|
||||
editingName = false
|
||||
}}
|
||||
>
|
||||
<TextInput bind:value={theme.name}></TextInput>
|
||||
</form>
|
||||
{:else}
|
||||
<button
|
||||
onclick={() => {
|
||||
if (theme.id > 0) editingName = true
|
||||
}}
|
||||
class="text-left font-medium text-lg font-display"
|
||||
>
|
||||
{theme.name}
|
||||
</button>
|
||||
{/if}
|
||||
<FreeTextInput
|
||||
bind:value={theme.name}
|
||||
disabled={theme.id <= 0}
|
||||
class={[
|
||||
'text-left font-medium text-lg font-display disabled:pointer-events-none',
|
||||
]}
|
||||
>
|
||||
{theme.name}
|
||||
</FreeTextInput>
|
||||
{#if theme.id > 0}
|
||||
<Button
|
||||
color="ghost"
|
||||
|
||||
Reference in new issue
Block a user