Merge pull request #634 from Xyphyn/mobile-impr
design: misc improvements
This commit is contained in:
7 files changed
+70
-27
No files matched your search
@@ -9,7 +9,15 @@
|
||||
import { getClient } from '$lib/lemmy.svelte.js'
|
||||
import { errorMessage } from '$lib/lemmy/error'
|
||||
import { Button, Modal, toast } from 'mono-svelte'
|
||||
import { Bookmark, Icon, Microphone, Pencil, Trash } from 'svelte-hero-icons'
|
||||
import {
|
||||
Bookmark,
|
||||
Icon,
|
||||
Microphone,
|
||||
Minus,
|
||||
Pencil,
|
||||
Plus,
|
||||
Trash,
|
||||
} from 'svelte-hero-icons'
|
||||
import { expoOut } from 'svelte/easing'
|
||||
import type { ClassValue } from 'svelte/elements'
|
||||
import { slide } from 'svelte/transition'
|
||||
@@ -116,8 +124,23 @@
|
||||
{#if meta}
|
||||
<button
|
||||
onclick={() => (open = !open)}
|
||||
class="flex flex-row cursor-pointer gap-2 items-center group text-[13px] flex-wrap w-full z-0 group"
|
||||
class="flex flex-row cursor-pointer gap-2 items-center group text-sm flex-wrap w-full z-0 group relative"
|
||||
>
|
||||
<div
|
||||
class={[
|
||||
'absolute -inset-0.5 right-1 group-hover:right-0 group-hover:-inset-1.5 opacity-0 group-hover:opacity-100 transition-all',
|
||||
'bg-slate-100 dark:bg-zinc-900 -z-10 rounded-full',
|
||||
]}
|
||||
>
|
||||
<div
|
||||
class={[
|
||||
!open && 'rotate-90',
|
||||
'transition-all duration-500 ease-out ml-auto my-auto h-full w-8 grid place-items-center',
|
||||
]}
|
||||
>
|
||||
<Icon src={open ? Minus : Plus} size="16" micro />
|
||||
</div>
|
||||
</div>
|
||||
{@render metaSuffix?.()}
|
||||
<span class:font-bold={op} class="flex flex-row gap-1 items-center">
|
||||
<UserLink
|
||||
|
||||
@@ -98,9 +98,7 @@
|
||||
node.comment_view.counts.child_count > 0) &&
|
||||
'border-l',
|
||||
'ml-2.5 pl-3 sm:pl-4 lg:pl-5',
|
||||
node.depth % 2 == 0
|
||||
? 'border-slate-200 dark:border-zinc-800'
|
||||
: 'border-slate-300/80 dark:border-zinc-700',
|
||||
'border-slate-200 dark:border-zinc-800',
|
||||
]}
|
||||
bind:open={nodes[index].expanded}
|
||||
>
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
<script lang="ts" module>
|
||||
export const voteColor = (vote: number) =>
|
||||
vote == 1
|
||||
? `bg-linear-to-br from-blue-500 to-indigo-500 dark:from-blue-400 dark:to-indigo-500 text-slate-50 dark:text-zinc-900`
|
||||
? `bg-primary-900 dark:bg-primary-100 text-slate-50 dark:text-zinc-900`
|
||||
: vote == -1
|
||||
? `bg-linear-to-br from-red-500 to-pink-500 dark:from-red-400 dark:to-pink-600 text-slate-50 `
|
||||
? `dark:bg-red-400 dark:text-zinc-900`
|
||||
: ''
|
||||
|
||||
export const shouldShowVoteColor = (
|
||||
@@ -33,8 +33,8 @@
|
||||
post: Post
|
||||
vote?: number
|
||||
score: number
|
||||
upvotes?: number
|
||||
downvotes?: number
|
||||
upvotes: number
|
||||
downvotes: number
|
||||
showCounts?: boolean
|
||||
children?: import('svelte').Snippet<[{ vote?: number; score?: number }]>
|
||||
}
|
||||
@@ -56,14 +56,32 @@
|
||||
toast({ content: $t('toast.loginVoteGate'), type: 'warning' })
|
||||
return
|
||||
}
|
||||
loading = true
|
||||
|
||||
switch (vote ?? 0) {
|
||||
case 0:
|
||||
// nothing was removed
|
||||
if (newVote == 1) upvotes++
|
||||
else downvotes++
|
||||
break
|
||||
case 1:
|
||||
// removed an upvote
|
||||
upvotes--
|
||||
if (newVote == -1) downvotes++
|
||||
break
|
||||
case -1:
|
||||
// removed a downvote
|
||||
downvotes--
|
||||
if (newVote == 1) upvotes++
|
||||
break
|
||||
}
|
||||
|
||||
vote = newVote
|
||||
const res = await voteItem(post, newVote).catch(e => {
|
||||
toast({ content: errorMessage(e), type: 'error' })
|
||||
return { upvotes: 0, downvotes: 0, score: 0 }
|
||||
})
|
||||
;({ upvotes, downvotes, score } = res)
|
||||
loading = false
|
||||
|
||||
voteItem(post, newVote)
|
||||
.then(res => ({ upvotes, downvotes, score } = res))
|
||||
.catch(e => {
|
||||
toast({ content: errorMessage(e), type: 'error' })
|
||||
})
|
||||
}
|
||||
</script>
|
||||
|
||||
@@ -73,7 +91,7 @@
|
||||
)}
|
||||
<div
|
||||
class={[
|
||||
buttonColor.ghost,
|
||||
buttonColor.secondary,
|
||||
'rounded-full h-full font-medium flex items-center *:p-2 relative',
|
||||
'hover:bg-white dark:hover:bg-zinc-900 overflow-hidden transition-colors shrink-0',
|
||||
'text-inherit! divide-x divide-slate-200 dark:divide-zinc-800 shadow-xs',
|
||||
|
||||
@@ -51,7 +51,7 @@
|
||||
{#if editing}
|
||||
<Modal bind:open={editing}>
|
||||
{#snippet customTitle()}
|
||||
<h1 class="text-2xl font-bold">Editing post</h1>
|
||||
<h1 class="text-2xl font-bold">{$t('form.edit')}</h1>
|
||||
{/snippet}
|
||||
{#await import('../form/PostForm.svelte')}
|
||||
<div class="mx-auto h-96 flex justify-center items-center">
|
||||
@@ -76,7 +76,10 @@
|
||||
{/if}
|
||||
|
||||
<footer
|
||||
class="flex flex-row gap-2 items-center shrink-0 {buttonHeight}"
|
||||
class={[
|
||||
'flex flex-row gap-2 items-center shrink-0 text-slate-600 dark:text-zinc-400',
|
||||
buttonHeight,
|
||||
]}
|
||||
class:flex-row-reverse={settings.posts.reverseActions}
|
||||
{style}
|
||||
>
|
||||
@@ -94,7 +97,7 @@
|
||||
size="custom"
|
||||
href="{postLink(post.post)}#comments"
|
||||
class="text-inherit! h-full px-3 relative"
|
||||
color="ghost"
|
||||
color="secondary"
|
||||
rounding="pill"
|
||||
target={settings.openLinksInNewTab ? '_blank' : ''}
|
||||
title={$t('post.actions.comments')}
|
||||
@@ -119,7 +122,7 @@
|
||||
onclick={() => (debug = true)}
|
||||
title="Debug"
|
||||
size="custom"
|
||||
color="ghost"
|
||||
color="secondary"
|
||||
rounding="pill"
|
||||
class={buttonSquare}
|
||||
animations={{ scale: true, large: true }}
|
||||
@@ -135,7 +138,7 @@
|
||||
{#snippet target(acting)}
|
||||
<Button
|
||||
size="custom"
|
||||
color="ghost"
|
||||
color="secondary"
|
||||
rounding="pill"
|
||||
loading={acting}
|
||||
class={buttonSquare}
|
||||
@@ -157,7 +160,7 @@
|
||||
}}
|
||||
size="custom"
|
||||
class={buttonSquare}
|
||||
color="ghost"
|
||||
color="secondary"
|
||||
rounding="pill"
|
||||
loading={saving}
|
||||
disabled={saving}
|
||||
@@ -173,7 +176,7 @@
|
||||
{#snippet target()}
|
||||
<Button
|
||||
title={$t('post.actions.more.label')}
|
||||
color="ghost"
|
||||
color="secondary"
|
||||
rounding="pill"
|
||||
size="custom"
|
||||
class={buttonSquare}
|
||||
|
||||
@@ -34,6 +34,7 @@
|
||||
class={[
|
||||
'flex flex-col-reverse sm:flex-row overflow-hidden gap-4 embed-card z-0 relative',
|
||||
'dark:bg-zinc-950 group-hover/link:bg-slate-50 dark:group-hover/link:bg-zinc-900 transition-colors',
|
||||
'shadow-xs',
|
||||
]}
|
||||
rounding="2xl"
|
||||
element="article"
|
||||
|
||||
@@ -81,7 +81,7 @@
|
||||
}
|
||||
|
||||
.content.limit-width {
|
||||
max-width: 90rem;
|
||||
max-width: 100rem;
|
||||
}
|
||||
|
||||
@media (min-width: 48rem) {
|
||||
|
||||
@@ -14,8 +14,8 @@
|
||||
dark:bg-primary-100 dark:text-black hover:brightness-125 dark:hover:brightness-90 active:brightness-90
|
||||
dark:active:brightness-75`,
|
||||
|
||||
secondary: `border border-slate-200 border-b-slate-300 dark:border-zinc-800 dark:border-t-zinc-700/50 bg-white dark:bg-zinc-900
|
||||
hover:bg-slate-100 dark:hover:bg-zinc-800 dark:hover:border-zinc-700 dark:hover:border-zinc-700 dark:active:bg-zinc-900 active:bg-slate-200`,
|
||||
secondary: `border border-slate-200 border-b-slate-300 dark:border-zinc-800 bg-white dark:bg-zinc-900
|
||||
hover:bg-slate-100 dark:hover:bg-zinc-800 dark:hover:border-zinc-700 dark:active:bg-zinc-900 active:bg-slate-200`,
|
||||
|
||||
tertiary:
|
||||
'border border-transparent bg-transparent hover:bg-slate-100 dark:hover:bg-zinc-700/30 dark:text-zinc-200',
|
||||
|
||||
Reference in new issue
Block a user