feat: add post body closing and expanding
This commit is contained in:
1 parent
c20425b471
commit
3f06735fa7
4 files changed
+61
-17
No files matched your search
+1
-1
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "photon-lemmy",
|
"name": "photon-lemmy",
|
||||||
"version": "1.24.1",
|
"version": "1.24.2",
|
||||||
"private": true,
|
"private": true,
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"dev": "vite dev",
|
"dev": "vite dev",
|
||||||
|
|||||||
@@ -19,6 +19,7 @@
|
|||||||
import { Icon, VideoCamera } from 'svelte-hero-icons'
|
import { Icon, VideoCamera } from 'svelte-hero-icons'
|
||||||
import PostMedia from '$lib/components/lemmy/post/media/PostMedia.svelte'
|
import PostMedia from '$lib/components/lemmy/post/media/PostMedia.svelte'
|
||||||
import PostMediaCompact from '$lib/components/lemmy/post/media/PostMediaCompact.svelte'
|
import PostMediaCompact from '$lib/components/lemmy/post/media/PostMediaCompact.svelte'
|
||||||
|
import PostBody from './PostBody.svelte'
|
||||||
|
|
||||||
export let post: PostView
|
export let post: PostView
|
||||||
export let actions: boolean = true
|
export let actions: boolean = true
|
||||||
@@ -78,14 +79,7 @@
|
|||||||
</div>
|
</div>
|
||||||
<PostMedia bind:post={post.post} {view} {type} />
|
<PostMedia bind:post={post.post} {view} {type} />
|
||||||
{#if post.post.body && !post.post.nsfw && view != 'compact'}
|
{#if post.post.body && !post.post.nsfw && view != 'compact'}
|
||||||
<div
|
<PostBody body={post.post.body} {view} />
|
||||||
class="text-sm relative overflow-hidden
|
|
||||||
bg-gradient-to-b text-transparent from-slate-600 via-slate-600
|
|
||||||
dark:from-zinc-400 dark:via-zinc-400 bg-clip-text
|
|
||||||
{view == 'list' ? `max-h-24` : 'max-h-48'}"
|
|
||||||
>
|
|
||||||
<Markdown inline source={post.post.body} />
|
|
||||||
</div>
|
|
||||||
{/if}
|
{/if}
|
||||||
</div>
|
</div>
|
||||||
{#if view == 'list' || view == 'compact'}
|
{#if view == 'list' || view == 'compact'}
|
||||||
|
|||||||
@@ -0,0 +1,37 @@
|
|||||||
|
<script lang="ts">
|
||||||
|
import Markdown from '$lib/components/markdown/Markdown.svelte'
|
||||||
|
import type { View } from '$lib/settings'
|
||||||
|
import { Button } from 'mono-svelte'
|
||||||
|
import { ChevronDown, Icon } from 'svelte-hero-icons'
|
||||||
|
|
||||||
|
export let body: string
|
||||||
|
export let view: View = 'cozy'
|
||||||
|
let expanded = false
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<div
|
||||||
|
style="transition: max-height 300ms cubic-bezier(0.075, 0.82, 0.165, 1)"
|
||||||
|
class={!expanded
|
||||||
|
? `text-sm overflow-hidden
|
||||||
|
bg-gradient-to-b text-transparent from-slate-600 via-slate-600
|
||||||
|
dark:from-zinc-400 dark:via-zinc-400 bg-clip-text z-0
|
||||||
|
${view == 'list' ? `max-h-24` : 'max-h-48'}`
|
||||||
|
: 'text-slate-600 dark:text-zinc-400 max-h-full'}
|
||||||
|
>
|
||||||
|
<Markdown inline={!expanded} source={body} />
|
||||||
|
<Button
|
||||||
|
on:click={() => (expanded = !expanded)}
|
||||||
|
size="square-sm"
|
||||||
|
color="tertiary"
|
||||||
|
class="text-black dark:text-white absolute z-10 isolate shadow-xl {expanded
|
||||||
|
? 'bottom-6'
|
||||||
|
: 'bottom-16'} left-1/2 -translate-x-1/2"
|
||||||
|
>
|
||||||
|
<Icon
|
||||||
|
src={ChevronDown}
|
||||||
|
size="20"
|
||||||
|
mini
|
||||||
|
class="{expanded ? 'rotate-180' : ''} transition-transform"
|
||||||
|
/>
|
||||||
|
</Button>
|
||||||
|
</div>
|
||||||
@@ -14,6 +14,7 @@
|
|||||||
import {
|
import {
|
||||||
ArrowRight,
|
ArrowRight,
|
||||||
ChartBar,
|
ChartBar,
|
||||||
|
Cog6Tooth,
|
||||||
EllipsisHorizontal,
|
EllipsisHorizontal,
|
||||||
Icon,
|
Icon,
|
||||||
XMark,
|
XMark,
|
||||||
@@ -84,14 +85,26 @@
|
|||||||
).hostname}
|
).hostname}
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
<Button
|
<div class="flex items-center gap-2 w-max ml-auto">
|
||||||
size="square-md"
|
<Button
|
||||||
color="secondary"
|
size="square-md"
|
||||||
class="ml-auto"
|
color="secondary"
|
||||||
on:click={() => (sidebar = !sidebar)}
|
href="/c/{fullCommunityName(
|
||||||
>
|
data.community.community_view.community.name,
|
||||||
<Icon src={EllipsisHorizontal} size="16" mini />
|
data.community.community_view.community.actor_id
|
||||||
</Button>
|
)}/settings"
|
||||||
|
on:click={() => (sidebar = !sidebar)}
|
||||||
|
>
|
||||||
|
<Icon src={Cog6Tooth} size="16" mini />
|
||||||
|
</Button>
|
||||||
|
<Button
|
||||||
|
size="square-md"
|
||||||
|
color="secondary"
|
||||||
|
on:click={() => (sidebar = !sidebar)}
|
||||||
|
>
|
||||||
|
<Icon src={EllipsisHorizontal} size="16" mini />
|
||||||
|
</Button>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="flex flex-row gap-4 max-w-full w-full items-end">
|
<div class="flex flex-row gap-4 max-w-full w-full items-end">
|
||||||
<Sort selected={data.sort} />
|
<Sort selected={data.sort} />
|
||||||
|
|||||||
Reference in new issue
Block a user