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 Avatar from '$lib/components/ui/Avatar.svelte'
|
||||
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 expanded: boolean
|
||||
</script>
|
||||
|
||||
{#each items.sort((a, b) => a.title.localeCompare(b.title)) as follow}
|
||||
<Button
|
||||
class="hover:bg-slate-200 {expanded ? '' : '!p-1.5'}"
|
||||
color="tertiary"
|
||||
alignment="left"
|
||||
href="/c/{follow.name}@{new URL(follow.actor_id).hostname}"
|
||||
{#each items.sort( (a, b) => a.title.localeCompare(b.title) ) as follow (follow.id)}
|
||||
<div
|
||||
class="inline-flex w-full"
|
||||
animate:flip={{ duration: 500, easing: expoOut }}
|
||||
>
|
||||
<div class="flex-none">
|
||||
<Avatar
|
||||
url={follow.icon}
|
||||
alt={follow.name}
|
||||
title={follow.title}
|
||||
width={20}
|
||||
slot="icon"
|
||||
/>
|
||||
</div>
|
||||
<span class="max-w-full break-words" class:hidden={!expanded}>
|
||||
{follow.title}
|
||||
</span>
|
||||
</Button>
|
||||
<Button
|
||||
class="hover:bg-slate-200 w-full h-max {expanded ? '' : '!p-1.5'}"
|
||||
color="tertiary"
|
||||
alignment="left"
|
||||
href="/c/{follow.name}@{new URL(follow.actor_id).hostname}"
|
||||
>
|
||||
<div class="flex-none">
|
||||
<Avatar
|
||||
url={follow.icon}
|
||||
alt={follow.name}
|
||||
title={follow.title}
|
||||
width={20}
|
||||
slot="icon"
|
||||
/>
|
||||
</div>
|
||||
<span class="max-w-full break-words" class:hidden={!expanded}>
|
||||
{follow.title}
|
||||
</span>
|
||||
</Button>
|
||||
</div>
|
||||
{/each}
|
||||
Reference in new issue
Block a user