From 3b42fb61f9b4839eb408519a5192b460ec6f33f5 Mon Sep 17 00:00:00 2001 From: Xylight Date: Fri, 17 Oct 2025 19:19:11 -0700 Subject: [PATCH] design: improve big card for community --- .../feature/community/CommunityItemBig.svelte | 190 ++++++++++++++++++ src/lib/feature/post/PostForm.svelte | 1 + src/lib/feature/post/PostMeta.svelte | 2 +- src/lib/ui/generic/Avatar.svelte | 7 +- src/lib/ui/layout/CommonList.svelte | 11 +- src/lib/ui/layout/Shell.svelte | 14 +- src/lib/ui/layout/pages/Header.svelte | 4 +- src/lib/ui/shared/forms/Switch.svelte | 4 +- src/lib/ui/shared/materials/Material.svelte | 12 +- src/routes/explore/communities/+page.svelte | 7 +- 10 files changed, 232 insertions(+), 20 deletions(-) create mode 100644 src/lib/feature/community/CommunityItemBig.svelte diff --git a/src/lib/feature/community/CommunityItemBig.svelte b/src/lib/feature/community/CommunityItemBig.svelte new file mode 100644 index 00000000..e8f2c411 --- /dev/null +++ b/src/lib/feature/community/CommunityItemBig.svelte @@ -0,0 +1,190 @@ + + +{#snippet communityInfo()} + +{/snippet} + +
+ +
+ {#if community.community.banner} + + {:else if community.community.icon} + + {:else} +
+ +
+ {/if} +
+
+
+

+ {community.community.title} +

+

+ {new URL(community.community.actor_id).hostname} +

+
+ +
+ {#if community.community.deleted} + + {/if} + {#if community.community.nsfw} + + {/if} + {#if community.banned_from_community} + + {/if} + {#if community.community.visibility == 'LocalOnly'} + + {/if} +
+ + + {#snippet children({ subscribe, subscribing })} + {@const subscribed = + community.subscribed == 'Subscribed' || + community.subscribed == 'Pending'} + + {/snippet} + +
+ {#if children} +
+ {@render children?.()} +
+ {/if} +
diff --git a/src/lib/feature/post/PostForm.svelte b/src/lib/feature/post/PostForm.svelte index 9c12b6e8..f61cae7e 100644 --- a/src/lib/feature/post/PostForm.svelte +++ b/src/lib/feature/post/PostForm.svelte @@ -320,6 +320,7 @@ data.community = c }} + class="w-max" /> {:else}
diff --git a/src/lib/feature/post/PostMeta.svelte b/src/lib/feature/post/PostMeta.svelte index 12118f5b..be8f352b 100644 --- a/src/lib/feature/post/PostMeta.svelte +++ b/src/lib/feature/post/PostMeta.svelte @@ -360,7 +360,7 @@ {@const useAttachedUrl = settings.posts.titleOpensUrl && postUrl}

diff --git a/src/lib/ui/layout/CommonList.svelte b/src/lib/ui/layout/CommonList.svelte index 61f3d4c4..07f048bf 100644 --- a/src/lib/ui/layout/CommonList.svelte +++ b/src/lib/ui/layout/CommonList.svelte @@ -29,7 +29,7 @@ }: Props = $props() -
    +
      {#if items} {#each items as item, index (item)}
    • diff --git a/src/lib/ui/shared/materials/Material.svelte b/src/lib/ui/shared/materials/Material.svelte index b1d63ce5..8215cd3e 100644 --- a/src/lib/ui/shared/materials/Material.svelte +++ b/src/lib/ui/shared/materials/Material.svelte @@ -53,7 +53,7 @@ } let { - elevation = 'flat', + elevation = 'medium', padding = 'md', rounding = 'xl', color = 'uniform', @@ -95,6 +95,16 @@ background-color: var(--color-zinc-900); border-color: var(--color-zinc-800); border-top-color: var(--color-zinc-700); + + @variant hover { + @variant dark { + background-color: var(--color-zinc-925); + } + } + } + + @variant hover { + background-color: var(--color-slate-100); } } diff --git a/src/routes/explore/communities/+page.svelte b/src/routes/explore/communities/+page.svelte index 65bec25f..619ff324 100644 --- a/src/routes/explore/communities/+page.svelte +++ b/src/routes/explore/communities/+page.svelte @@ -2,6 +2,7 @@ import { navigating, page } from '$app/state' import { t } from '$lib/app/i18n' import CommunityItem from '$lib/feature/community/CommunityItem.svelte' + import CommunityItemBig from '$lib/feature/community/CommunityItemBig.svelte' import Fixate from '$lib/ui/generic/Fixate.svelte' import Skeleton from '$lib/ui/generic/Skeleton.svelte' import Placeholder from '$lib/ui/info/Placeholder.svelte' @@ -51,7 +52,7 @@ {$t('routes.search.top')}
      {#each data.communities.slice(0, 3) as community, index (community.community.id)}
      - - + +
      {/each}