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