feat: redesign communityitem
This commit is contained in:
1 parent
371fc4a28b
commit
b79496a1c9
4 files changed
+36
-29
No files matched your search
@@ -18,6 +18,8 @@
|
|||||||
import { addSubscription } from '$lib/lemmy/user.js'
|
import { addSubscription } from '$lib/lemmy/user.js'
|
||||||
import Avatar from '$lib/components/ui/Avatar.svelte'
|
import Avatar from '$lib/components/ui/Avatar.svelte'
|
||||||
import CommunityCard from '$lib/components/lemmy/community/CommunityCard.svelte'
|
import CommunityCard from '$lib/components/lemmy/community/CommunityCard.svelte'
|
||||||
|
import LabelStat from '$lib/components/ui/LabelStat.svelte'
|
||||||
|
import PostBody from '../post/PostBody.svelte'
|
||||||
|
|
||||||
export let community: CommunityView
|
export let community: CommunityView
|
||||||
|
|
||||||
@@ -28,17 +30,17 @@
|
|||||||
<CommunityCard community_view={community} />
|
<CommunityCard community_view={community} />
|
||||||
</Modal>
|
</Modal>
|
||||||
|
|
||||||
<div class="py-4 flex flex-col gap-1 text-sm max-w-full">
|
<div class="py-4 flex flex-col gap-2 text-sm max-w-full relative">
|
||||||
<div class="flex flex-row items-center">
|
<div class="flex flex-row items-center">
|
||||||
<span
|
<div class="flex flex-col">
|
||||||
class="break-words max-w-full w-max text-base font-bold hover:underline"
|
|
||||||
>
|
|
||||||
<CommunityLink
|
<CommunityLink
|
||||||
showInstance={false}
|
showInstance={true}
|
||||||
avatar
|
avatar
|
||||||
community={community.community}
|
community={community.community}
|
||||||
|
class="font-medium text-base"
|
||||||
|
instanceClass="text-xs"
|
||||||
/>
|
/>
|
||||||
</span>
|
</div>
|
||||||
<div class="ml-auto flex flex-row items-center gap-2">
|
<div class="ml-auto flex flex-row items-center gap-2">
|
||||||
<Button size="square-md" on:click={() => (showInfo = !showInfo)}>
|
<Button size="square-md" on:click={() => (showInfo = !showInfo)}>
|
||||||
<Icon src={InformationCircle} size="16" mini />
|
<Icon src={InformationCircle} size="16" mini />
|
||||||
@@ -83,21 +85,24 @@
|
|||||||
</Subscribe>
|
</Subscribe>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<span class="text-slate-600 dark:text-zinc-400 mb-2">
|
{#if community.community.description}
|
||||||
!{community.community.name}@{new URL(community.community.actor_id).hostname}
|
<PostBody body={community.community.description} view="list"></PostBody>
|
||||||
</span>
|
{/if}
|
||||||
<div class="flex flex-row gap-3 items-center">
|
<div class="flex flex-row gap-3 items-center">
|
||||||
<div class="flex flex-row gap-1 items-center">
|
<LabelStat
|
||||||
<Icon src={UserGroup} width={16} mini />
|
content={community.counts.posts.toString()}
|
||||||
<FormattedNumber number={community.counts.subscribers} />
|
formatted
|
||||||
</div>
|
label="Posts"
|
||||||
<div class="flex flex-row gap-1 items-center">
|
/>
|
||||||
<Icon src={PencilSquare} mini width={16} />
|
<LabelStat
|
||||||
<FormattedNumber number={community.counts.posts} />
|
content={community.counts.subscribers.toString()}
|
||||||
</div>
|
formatted
|
||||||
<div class="flex flex-row gap-1 items-center">
|
label="Members"
|
||||||
<Icon src={ChatBubbleOvalLeftEllipsis} mini width={16} />
|
/>
|
||||||
<FormattedNumber number={community.counts.comments} />
|
<LabelStat
|
||||||
</div>
|
content={community.counts.comments.toString()}
|
||||||
|
formatted
|
||||||
|
label="Comments"
|
||||||
|
/>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@@ -13,7 +13,8 @@
|
|||||||
|
|
||||||
<a
|
<a
|
||||||
{...$$restProps}
|
{...$$restProps}
|
||||||
class="items-center flex flex-row gap-2 hover:underline flex-shrink-0"
|
class="items-center flex flex-row gap-2 hover:underline flex-shrink-0 {$$props.class ||
|
||||||
|
''}"
|
||||||
href="/c/{community.name}@{new URL(community.actor_id).hostname}"
|
href="/c/{community.name}@{new URL(community.actor_id).hostname}"
|
||||||
>
|
>
|
||||||
{#if avatar}
|
{#if avatar}
|
||||||
@@ -26,10 +27,13 @@
|
|||||||
{/if}
|
{/if}
|
||||||
|
|
||||||
{#if name}
|
{#if name}
|
||||||
<span class="flex gap-0">
|
<span class="flex gap-0 items-center">
|
||||||
{#if showInstance}
|
{#if showInstance}
|
||||||
<span class="font-medium">{community.title}</span>
|
<span class="font-medium">{community.title}</span>
|
||||||
<span class="text-slate-500 dark:text-zinc-500 font-normal">
|
<span
|
||||||
|
class="text-slate-500 dark:text-zinc-500 font-normal {$$props.instanceClass ||
|
||||||
|
''}"
|
||||||
|
>
|
||||||
@{new URL(community.actor_id).hostname}
|
@{new URL(community.actor_id).hostname}
|
||||||
</span>
|
</span>
|
||||||
{:else}
|
{:else}
|
||||||
|
|||||||
@@ -19,7 +19,7 @@
|
|||||||
</script>
|
</script>
|
||||||
|
|
||||||
<div
|
<div
|
||||||
style="transition: max-height 300ms cubic-bezier(0.075, 0.82, 0.165, 1); {$$props.style ?? ''}"
|
style={$$props.style ?? ''}
|
||||||
class={!expanded
|
class={!expanded
|
||||||
? `text-sm overflow-hidden
|
? `text-sm overflow-hidden
|
||||||
bg-gradient-to-b text-transparent from-slate-600 via-slate-600
|
bg-gradient-to-b text-transparent from-slate-600 via-slate-600
|
||||||
|
|||||||
@@ -8,9 +8,7 @@
|
|||||||
QuestionMarkCircle,
|
QuestionMarkCircle,
|
||||||
} from 'svelte-hero-icons'
|
} from 'svelte-hero-icons'
|
||||||
import Pageination from '$lib/components/ui/Pageination.svelte'
|
import Pageination from '$lib/components/ui/Pageination.svelte'
|
||||||
import {
|
import { searchParam } from '$lib/util.js'
|
||||||
searchParam,
|
|
||||||
} from '$lib/util.js'
|
|
||||||
import { Button, Material, Popover, Select, TextInput } from 'mono-svelte'
|
import { Button, Material, Popover, Select, TextInput } from 'mono-svelte'
|
||||||
import Sort from '$lib/components/lemmy/Sort.svelte'
|
import Sort from '$lib/components/lemmy/Sort.svelte'
|
||||||
import Placeholder from '$lib/components/ui/Placeholder.svelte'
|
import Placeholder from '$lib/components/ui/Placeholder.svelte'
|
||||||
@@ -90,7 +88,7 @@
|
|||||||
</Button>
|
</Button>
|
||||||
</form>
|
</form>
|
||||||
</div>
|
</div>
|
||||||
<ul class="flex flex-col divide-y dark:divide-zinc-800">
|
<ul class="flex flex-col divide-y divide-slate-200 dark:divide-zinc-800">
|
||||||
{#if data.communities.length == 0}
|
{#if data.communities.length == 0}
|
||||||
<Placeholder
|
<Placeholder
|
||||||
icon={QuestionMarkCircle}
|
icon={QuestionMarkCircle}
|
||||||
|
|||||||
Reference in new issue
Block a user