feat: Add community sidebar in mobile view

This commit is contained in:
Xyphyn committed 2023-07-10 19:41:05 -07:00
1 parent 1a872152d4
commit 46ad2fe72b
4 files changed
+79 -58

No files matched your search

@@ -1,6 +1,7 @@
<script lang="ts">
import Markdown from '$lib/components/markdown/Markdown.svelte'
import Avatar from '$lib/components/ui/Avatar.svelte'
import Card from '$lib/components/ui/Card.svelte'
import StickyCard from '$lib/components/ui/StickyCard.svelte'
import FormattedNumber from '$lib/components/util/FormattedNumber.svelte'
import RelativeDate from '$lib/components/util/RelativeDate.svelte'
+1 -1
View File
@@ -1,6 +1,6 @@
<div
class="sticky top-20 border bg-white shadow-md border-slate-100
dark:border-zinc-800 dark:bg-zinc-900 break-words hidden lg:flex
dark:border-zinc-800 dark:bg-zinc-900 break-words flex
flex-col gap-4 p-8 max-w-[20rem] w-full flex-shrink-0 rounded-md h-max max-h-[calc(100vh-6rem)]
overflow-auto"
>
+30 -28
View File
@@ -65,38 +65,40 @@
</Button>
</div>
</div>
{#await data.streamed.site}
<StickyCard>
<div
class="w-[64px] h-[64px] rounded-full bg-slate-200
<div class="hidden md:block">
{#await data.streamed.site}
<StickyCard>
<div
class="w-[64px] h-[64px] rounded-full bg-slate-200
dark:bg-zinc-700 animate-pulse"
/>
<div
class="w-32 h-3 bg-slate-200 dark:bg-zinc-700 animate-pulse
/>
<div
class="w-32 h-3 bg-slate-200 dark:bg-zinc-700 animate-pulse
rounded-md"
/>
<div
class="w-64 h-3 bg-slate-200 dark:bg-zinc-700 animate-pulse
/>
<div
class="w-64 h-3 bg-slate-200 dark:bg-zinc-700 animate-pulse
rounded-md"
/>
<div
class="w-36 mt-4 h-4 bg-slate-200 dark:bg-zinc-700 animate-pulse
/>
<div
class="w-36 mt-4 h-4 bg-slate-200 dark:bg-zinc-700 animate-pulse
rounded-md"
/>
<div
class="w-full h-4 bg-slate-200 dark:bg-zinc-700 animate-pulse
/>
<div
class="w-full h-4 bg-slate-200 dark:bg-zinc-700 animate-pulse
rounded-md"
/>
<div
class="w-24 h-4 bg-slate-200 dark:bg-zinc-700 animate-pulse
/>
<div
class="w-24 h-4 bg-slate-200 dark:bg-zinc-700 animate-pulse
rounded-md"
/>
</StickyCard>
{:then site}
<SiteCard site={site.site_view} />
{:catch}
<StickyCard>
<h1 class="font-bold text-lg">Failed to load</h1>
</StickyCard>
{/await}
/>
</StickyCard>
{:then site}
<SiteCard site={site.site_view} />
{:catch}
<StickyCard>
<h1 class="font-bold text-lg">Failed to load</h1>
</StickyCard>
{/await}
</div>
</div>
+47 -29
View File
@@ -7,6 +7,7 @@
import Card from '$lib/components/ui/StickyCard.svelte'
import CommunityCard from '$lib/components/community/CommunityCard.svelte'
import Button from '$lib/components/input/Button.svelte'
import { Color } from '$lib/ui/colors'
export let data
</script>
@@ -15,7 +16,22 @@
<title>{data.posts.posts[0]?.community.name}</title>
</svelte:head>
<div class="flex flex-row gap-4 w-full">
<div class="flex flex-col md:flex-row gap-4 w-full">
<div class="md:hidden">
{#await data.streamed.community then community}
<details>
<summary class="flex flex-row">
<div
class="{Color.secondary} px-3 py-1 transition-colors text-sm
rounded-md cursor-pointer mb-1"
>
Sidebar
</div>
</summary>
<CommunityCard community_view={community.community_view} />
</details>
{/await}
</div>
<div class="flex flex-col gap-4 max-w-full w-full">
<div class="flex flex-col sm:flex-row gap-4 max-w-full w-full">
<MultiSelect
@@ -52,38 +68,40 @@
</Button>
</div>
</div>
{#await data.streamed.community}
<Card>
<div
class="w-[64px] h-[64px] rounded-full bg-slate-200
<div class="hidden md:block">
{#await data.streamed.community}
<Card>
<div
class="w-[64px] h-[64px] rounded-full bg-slate-200
dark:bg-zinc-700 animate-pulse"
/>
<div
class="w-32 h-3 bg-slate-200 dark:bg-zinc-700 animate-pulse
/>
<div
class="w-32 h-3 bg-slate-200 dark:bg-zinc-700 animate-pulse
rounded-md"
/>
<div
class="w-64 h-3 bg-slate-200 dark:bg-zinc-700 animate-pulse
/>
<div
class="w-64 h-3 bg-slate-200 dark:bg-zinc-700 animate-pulse
rounded-md"
/>
<div
class="w-36 h-4 bg-slate-200 dark:bg-zinc-700 animate-pulse
/>
<div
class="w-36 h-4 bg-slate-200 dark:bg-zinc-700 animate-pulse
rounded-md"
/>
<div
class="w-full h-4 bg-slate-200 dark:bg-zinc-700 animate-pulse
/>
<div
class="w-full h-4 bg-slate-200 dark:bg-zinc-700 animate-pulse
rounded-md"
/>
<div
class="w-24 h-4 bg-slate-200 dark:bg-zinc-700 animate-pulse
/>
<div
class="w-24 h-4 bg-slate-200 dark:bg-zinc-700 animate-pulse
rounded-md"
/>
</Card>
{:then community}
<CommunityCard community_view={community.community_view} />
{:catch}
<Card>
<p>Failed to load community. This is likely an issue on Lemmy's end.</p>
</Card>
{/await}
/>
</Card>
{:then community}
<CommunityCard community_view={community.community_view} />
{:catch}
<Card>
<p>Failed to load community. This is likely an issue on Lemmy's end.</p>
</Card>
{/await}
</div>
</div>