feat: fix sidebar communities
This commit is contained in:
1 parent
9b15224b84
commit
c1abaa386a
2 files changed
+29
-20
No files matched your search
@@ -2,29 +2,37 @@
|
|||||||
import Button from '$lib/components/input/Button.svelte'
|
import Button from '$lib/components/input/Button.svelte'
|
||||||
import Avatar from '$lib/components/ui/Avatar.svelte'
|
import Avatar from '$lib/components/ui/Avatar.svelte'
|
||||||
import type { Community } from 'lemmy-js-client'
|
import type { Community } from 'lemmy-js-client'
|
||||||
|
import { flip } from 'svelte/animate'
|
||||||
|
import { expoOut } from 'svelte/easing'
|
||||||
|
import { slide } from 'svelte/transition'
|
||||||
|
|
||||||
export let items: Community[]
|
export let items: Community[]
|
||||||
export let expanded: boolean
|
export let expanded: boolean
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
{#each items.sort((a, b) => a.title.localeCompare(b.title)) as follow}
|
{#each items.sort( (a, b) => a.title.localeCompare(b.title) ) as follow (follow.id)}
|
||||||
<Button
|
<div
|
||||||
class="hover:bg-slate-200 {expanded ? '' : '!p-1.5'}"
|
class="inline-flex w-full"
|
||||||
color="tertiary"
|
animate:flip={{ duration: 500, easing: expoOut }}
|
||||||
alignment="left"
|
|
||||||
href="/c/{follow.name}@{new URL(follow.actor_id).hostname}"
|
|
||||||
>
|
>
|
||||||
<div class="flex-none">
|
<Button
|
||||||
<Avatar
|
class="hover:bg-slate-200 w-full h-max {expanded ? '' : '!p-1.5'}"
|
||||||
url={follow.icon}
|
color="tertiary"
|
||||||
alt={follow.name}
|
alignment="left"
|
||||||
title={follow.title}
|
href="/c/{follow.name}@{new URL(follow.actor_id).hostname}"
|
||||||
width={20}
|
>
|
||||||
slot="icon"
|
<div class="flex-none">
|
||||||
/>
|
<Avatar
|
||||||
</div>
|
url={follow.icon}
|
||||||
<span class="max-w-full break-words" class:hidden={!expanded}>
|
alt={follow.name}
|
||||||
{follow.title}
|
title={follow.title}
|
||||||
</span>
|
width={20}
|
||||||
</Button>
|
slot="icon"
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
<span class="max-w-full break-words" class:hidden={!expanded}>
|
||||||
|
{follow.title}
|
||||||
|
</span>
|
||||||
|
</Button>
|
||||||
|
</div>
|
||||||
{/each}
|
{/each}
|
||||||
@@ -115,7 +115,8 @@
|
|||||||
|
|
||||||
addSubscription(
|
addSubscription(
|
||||||
community.community,
|
community.community,
|
||||||
res.community_view.subscribed == 'Subscribed'
|
res.community_view.subscribed == 'Subscribed' ||
|
||||||
|
res.community_view.subscribed == 'Pending'
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}}
|
}}
|
||||||
|
|||||||
Reference in new issue
Block a user