feat: make community list expandable

This commit is contained in:
Xylight committed 2024-02-26 17:30:12 -08:00
1 parent df06eca4e6
commit 04c89fed13
2 files changed
+37 -12

No files matched your search

+24 -11
View File
@@ -1,15 +1,28 @@
<script>
import { Disclosure } from "mono-svelte"
import { ChevronDown, Icon } from "svelte-hero-icons"
<script lang="ts">
import { Disclosure } from 'mono-svelte'
import { ChevronDown, Icon } from 'svelte-hero-icons'
export let open: boolean = false
</script>
<Disclosure class="items-start justify-items-start gap-2 {$$props.class}">
<div slot="summary" class="font-medium w-full text-left flex flex-row items-center justify-between">
<div class="flex flex-row gap-1 items-center"><slot name="title" /></div>
<Icon src={ChevronDown} size="20" mini />
<Disclosure
bind:open
class="items-start justify-items-start gap-2 {$$props.class}"
>
<div
slot="summary"
class="font-medium w-full text-left flex flex-row items-center justify-between"
>
<div class="flex flex-row gap-1 items-center w-full">
<slot name="title" />
</div>
<Icon
src={ChevronDown}
size="20"
mini
class="{open ? 'rotate-180' : ''} transition-transform"
/>
</div>
<div class="pt-2">
<slot /></div>
</Disclosure>
<slot />
</div>
</Disclosure>
+13 -1
View File
@@ -19,6 +19,8 @@
import { expoOut } from 'svelte/easing'
import { Button } from 'mono-svelte'
import { DEFAULT_INSTANCE_URL, LINKED_INSTANCE_URL } from '$lib/instance.js'
import Expandable from '$lib/components/ui/Expandable.svelte'
import EndPlaceholder from '../EndPlaceholder.svelte'
export let route = ''
</script>
@@ -81,7 +83,17 @@
<hr class="border-slate-200 dark:border-zinc-800 my-1" />
{/if}
<CommunityList items={$profile.user.follows.map((i) => i.community)} />
<Expandable open>
<span slot="title" class="px-2 py-1 w-full">
<EndPlaceholder>
Subscribed
<span slot="action" class="dark:text-white text-black">
{$profile.user.follows.length}
</span>
</EndPlaceholder>
</span>
<CommunityList items={$profile.user.follows.map((i) => i.community)} />
</Expandable>
{:else}
<SidebarButton href="/login" title="Log In">
<Icon mini src={ArrowLeftOnRectangle} size="20" />