design: improve compact design responsiveness
This commit is contained in:
1 parent
8129275fa7
commit
d53cd28726
3 files changed
+46
-19
No files matched your search
@@ -41,7 +41,7 @@
|
|||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import CommunityLink from '$lib/components/lemmy/community/CommunityLink.svelte'
|
import CommunityLink from '$lib/components/lemmy/community/CommunityLink.svelte'
|
||||||
import Avatar from '$lib/components/ui/Avatar.svelte'
|
import Avatar from '$lib/components/ui/Avatar.svelte'
|
||||||
import { Badge, Material, Popover } from 'mono-svelte'
|
import { Badge, Popover } from 'mono-svelte'
|
||||||
import UserLink from '$lib/components/lemmy/user/UserLink.svelte'
|
import UserLink from '$lib/components/lemmy/user/UserLink.svelte'
|
||||||
import RelativeDate, {
|
import RelativeDate, {
|
||||||
formatRelativeDate,
|
formatRelativeDate,
|
||||||
@@ -49,18 +49,15 @@
|
|||||||
import type { Community, Person, SubscribedType } from 'lemmy-js-client'
|
import type { Community, Person, SubscribedType } from 'lemmy-js-client'
|
||||||
import {
|
import {
|
||||||
Bookmark,
|
Bookmark,
|
||||||
Check,
|
|
||||||
ExclamationTriangle,
|
ExclamationTriangle,
|
||||||
Icon,
|
Icon,
|
||||||
LockClosed,
|
LockClosed,
|
||||||
Megaphone,
|
Megaphone,
|
||||||
Plus,
|
|
||||||
Tag,
|
Tag,
|
||||||
Trash,
|
Trash,
|
||||||
|
PaperAirplane,
|
||||||
} from 'svelte-hero-icons'
|
} from 'svelte-hero-icons'
|
||||||
import { getInstance } from '$lib/lemmy.js'
|
import { getInstance } from '$lib/lemmy.js'
|
||||||
import { profile } from '$lib/auth.js'
|
|
||||||
import Subscribe from '../../../../routes/communities/Subscribe.svelte'
|
|
||||||
import ShieldIcon from '../moderation/ShieldIcon.svelte'
|
import ShieldIcon from '../moderation/ShieldIcon.svelte'
|
||||||
import { userSettings, type View } from '$lib/settings'
|
import { userSettings, type View } from '$lib/settings'
|
||||||
import Markdown from '$lib/components/markdown/Markdown.svelte'
|
import Markdown from '$lib/components/markdown/Markdown.svelte'
|
||||||
@@ -118,18 +115,18 @@
|
|||||||
class:compact={view == 'compact'}
|
class:compact={view == 'compact'}
|
||||||
style={$$props.style ?? ''}
|
style={$$props.style ?? ''}
|
||||||
>
|
>
|
||||||
{#if showCommunity && community && subscribed}
|
{#if showCommunity && community && subscribed && showCommunity}
|
||||||
<Popover bind:open={popoverOpen} manual>
|
<Popover bind:open={popoverOpen} manual>
|
||||||
<button
|
<button
|
||||||
on:click={() => (popoverOpen = !popoverOpen)}
|
on:click={() => (popoverOpen = !popoverOpen)}
|
||||||
class="relative cursor-pointer pr-2 row-span-2 flex-shrink-0 group/community"
|
class="relative cursor-pointer row-span-2 flex-shrink-0 pr-2 group/community"
|
||||||
slot="target"
|
slot="target"
|
||||||
>
|
>
|
||||||
<Avatar
|
<Avatar
|
||||||
url={community.icon}
|
url={community.icon}
|
||||||
width={view == 'compact' ? 24 : 32}
|
width={view == 'compact' ? 24 : 32}
|
||||||
alt={community.name}
|
alt={community.name}
|
||||||
class="group-hover/community:ring-2 transition-all ring-offset-1 ring-primary-900 dark:ring-primary-100"
|
class="group-hover/community:ring-2 transition-all ring-offset-0 ring-primary-900 dark:ring-primary-100"
|
||||||
/>
|
/>
|
||||||
</button>
|
</button>
|
||||||
<div
|
<div
|
||||||
@@ -146,17 +143,30 @@
|
|||||||
<CommunityLink
|
<CommunityLink
|
||||||
{community}
|
{community}
|
||||||
style="grid-area: community;"
|
style="grid-area: community;"
|
||||||
class="flex-shrink"
|
class="flex-shrink no-list-margin"
|
||||||
/>
|
/>
|
||||||
{/if}
|
{/if}
|
||||||
<div
|
<div
|
||||||
class="text-slate-600 dark:text-zinc-400 flex flex-row gap-2 items-center self-start
|
class="text-slate-600 dark:text-zinc-400 flex flex-row gap-2 items-center
|
||||||
{view == 'compact' ? 'mx-2' : ''}"
|
no-list-margin {view == 'compact' ? 'min-[480px]:mx-2' : ''}"
|
||||||
style="grid-area: stats;"
|
style="grid-area: stats;"
|
||||||
>
|
>
|
||||||
{#if user && view != 'compact'}
|
{#if user}
|
||||||
<address class="contents not-italic">
|
<address class="contents not-italic">
|
||||||
<UserLink avatarSize={20} {user} avatar={!showCommunity}>
|
{#if view == 'compact'}
|
||||||
|
<Icon
|
||||||
|
src={PaperAirplane}
|
||||||
|
size="12"
|
||||||
|
micro
|
||||||
|
class="rotate-180 text-slate-400 dark:text-zinc-600 max-[480px]:hidden"
|
||||||
|
/>
|
||||||
|
{/if}
|
||||||
|
<UserLink
|
||||||
|
avatarSize={20}
|
||||||
|
{user}
|
||||||
|
avatar={!showCommunity}
|
||||||
|
class="flex-shrink "
|
||||||
|
>
|
||||||
<svelte:fragment slot="badges">
|
<svelte:fragment slot="badges">
|
||||||
{#if badges.moderator}
|
{#if badges.moderator}
|
||||||
<ShieldIcon filled width={14} class="text-green-500" />
|
<ShieldIcon filled width={14} class="text-green-500" />
|
||||||
@@ -184,7 +194,8 @@
|
|||||||
{/if}
|
{/if}
|
||||||
</div>
|
</div>
|
||||||
<div
|
<div
|
||||||
class="flex flex-row justify-end items-center self-center flex-wrap gap-2 [&>*]:flex-shrink-0 badges ml-2"
|
class="flex flex-row min-[480px]:justify-end items-center self-center
|
||||||
|
flex-wrap gap-2 [&>*]:flex-shrink-0 badges min-[480px]:ml-2"
|
||||||
style="grid-area: badges;"
|
style="grid-area: badges;"
|
||||||
>
|
>
|
||||||
{#if tags}
|
{#if tags}
|
||||||
@@ -292,13 +303,27 @@
|
|||||||
'avatar stats badges';
|
'avatar stats badges';
|
||||||
gap: 0;
|
gap: 0;
|
||||||
grid-template-rows: auto auto;
|
grid-template-rows: auto auto;
|
||||||
grid-template-columns: max-content minmax(0, auto) auto;
|
grid-template-columns: 32px minmax(0, auto) auto;
|
||||||
}
|
}
|
||||||
|
|
||||||
.meta.compact {
|
@media screen and (max-width: 480px) {
|
||||||
display: flex;
|
.meta {
|
||||||
flex-direction: row;
|
grid-template-areas:
|
||||||
align-items: start;
|
'avatar community'
|
||||||
|
'avatar stats'
|
||||||
|
'badges badges';
|
||||||
|
gap: 0;
|
||||||
|
grid-template-rows: auto auto auto;
|
||||||
|
grid-template-columns: 32px minmax(0, auto) auto;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@media screen and (min-width: 480px) {
|
||||||
|
.meta.compact {
|
||||||
|
display: flex;
|
||||||
|
flex-direction: row;
|
||||||
|
align-items: center;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
:global(.badge-tag-color) {
|
:global(.badge-tag-color) {
|
||||||
|
|||||||
@@ -73,6 +73,7 @@
|
|||||||
href="/u/{user.name}@{new URL(user.actor_id).hostname}"
|
href="/u/{user.name}@{new URL(user.actor_id).hostname}"
|
||||||
data-sveltekit-preload-data="tap"
|
data-sveltekit-preload-data="tap"
|
||||||
>
|
>
|
||||||
|
<slot />
|
||||||
{#if avatar}
|
{#if avatar}
|
||||||
<Avatar
|
<Avatar
|
||||||
url={user.avatar}
|
url={user.avatar}
|
||||||
|
|||||||
@@ -103,6 +103,7 @@
|
|||||||
posts={data.posts.posts}
|
posts={data.posts.posts}
|
||||||
bind:feedData={data}
|
bind:feedData={data}
|
||||||
feedId="community"
|
feedId="community"
|
||||||
|
community
|
||||||
/>
|
/>
|
||||||
{/if}
|
{/if}
|
||||||
|
|
||||||
|
|||||||
Reference in new issue
Block a user