design: show icons by default in navbar
This commit is contained in:
4 files changed
+90
-86
No files matched your search
@@ -61,7 +61,7 @@
|
||||
style: 'grid-area: sidebar; width: 100% !important;',
|
||||
})}
|
||||
{@render main?.({
|
||||
class: `w-full bg-slate-50 dark:bg-zinc-925 justify-self-center border-x border-slate-200 dark:border-zinc-900 max-lg:pb-22 pb-3 sm:pb-6`,
|
||||
class: `w-full bg-slate-50 dark:bg-zinc-925 justify-self-center border-x border-slate-200 dark:border-zinc-900 max-lg:pb-22 pb-3 lg:pb-6`,
|
||||
style: 'grid-area: main',
|
||||
})}
|
||||
{@render suffix?.({
|
||||
|
||||
@@ -54,13 +54,16 @@
|
||||
aria-selected={isSelected}
|
||||
>
|
||||
{#snippet prefix()}
|
||||
<div class={(icon || customIcon) && adaptive ? 'lg:hidden' : ''}>
|
||||
{#if icon}
|
||||
{#if icon}
|
||||
<div class="hidden lg:block">
|
||||
<Icon src={icon} size="16" micro />
|
||||
</div>
|
||||
<div class="block lg:hidden">
|
||||
<Icon src={icon} size="20" mini />
|
||||
{:else}
|
||||
{@render customIcon?.({ size: 16, isSelected })}
|
||||
{/if}
|
||||
</div>
|
||||
</div>
|
||||
{:else}
|
||||
{@render customIcon?.({ size: 16, isSelected })}
|
||||
{/if}
|
||||
{/snippet}
|
||||
<span class="hidden {adaptive ? 'lg:block' : ''}">{label}</span>
|
||||
{@render children?.()}
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
<script lang="ts">
|
||||
import { notifications, profile } from '$lib/auth.svelte.js'
|
||||
import { site } from '$lib/client/lemmy.svelte'
|
||||
import {
|
||||
amModOfAny,
|
||||
isAdmin,
|
||||
@@ -7,14 +8,13 @@
|
||||
import Avatar from '$lib/components/ui/Avatar.svelte'
|
||||
import { t } from '$lib/i18n/translations'
|
||||
import { LINKED_INSTANCE_URL } from '$lib/instance.svelte'
|
||||
import { site } from '$lib/client/lemmy.svelte'
|
||||
import { Menu, Spinner } from 'mono-svelte'
|
||||
import {
|
||||
Bars3,
|
||||
GlobeAlt,
|
||||
Icon,
|
||||
MagnifyingGlass,
|
||||
Plus,
|
||||
PencilSquare,
|
||||
ServerStack,
|
||||
ShieldCheck,
|
||||
} from 'svelte-hero-icons'
|
||||
@@ -35,7 +35,9 @@
|
||||
<CommandsWrapper bind:open={promptOpen} />
|
||||
<nav
|
||||
class={[
|
||||
'flex flex-row gap-2 items-center w-full mx-auto z-50 box-border p-0.5 duration-150 @container',
|
||||
'w-full mx-auto z-50',
|
||||
'lg:gap-5 gap-2 flex flex-row items-center p-2',
|
||||
'box-border p-0.5 duration-150 @container',
|
||||
clazz,
|
||||
]}
|
||||
{style}
|
||||
@@ -48,7 +50,7 @@
|
||||
}}
|
||||
href="/"
|
||||
label={$t('nav.home')}
|
||||
class="ml-2 lg:ml-2 logo border-0 lg:rounded-full! lg:w-10! lg:h-10 lg:px-0! text-primary-900! dark:text-primary-100!"
|
||||
class="logo border-0 lg:rounded-full! lg:w-10! lg:h-10 lg:px-0! text-primary-900! dark:text-primary-100!"
|
||||
adaptive={false}
|
||||
>
|
||||
{#snippet customIcon()}
|
||||
@@ -68,85 +70,79 @@
|
||||
{/if}
|
||||
{/snippet}
|
||||
</NavButton>
|
||||
<div
|
||||
class="flex flex-row gap-2 lg:gap-5 py-2 px-2 items-center w-full overflow-auto"
|
||||
style="border-radius: inherit;"
|
||||
>
|
||||
<div class="ml-auto"></div>
|
||||
{#if profile.current?.user && isAdmin(profile.current.user)}
|
||||
<NavButton
|
||||
href="/admin"
|
||||
label={$t('nav.admin')}
|
||||
icon={ServerStack}
|
||||
class="relative"
|
||||
isSelectedFilter={(path) => path.startsWith('/admin')}
|
||||
/>
|
||||
{/if}
|
||||
{#if amModOfAny(profile.current?.user)}
|
||||
<NavButton
|
||||
href="/moderation"
|
||||
label={$t('nav.moderation')}
|
||||
class="relative"
|
||||
icon={ShieldCheck}
|
||||
/>
|
||||
{/if}
|
||||
<NavButton
|
||||
href="/explore/communities"
|
||||
label={$t('routes.explore.title')}
|
||||
icon={GlobeAlt}
|
||||
isSelectedFilter={(path) => path.startsWith('/explore')}
|
||||
/>
|
||||
<NavButton href="/search" label={$t('nav.search')} icon={MagnifyingGlass} />
|
||||
<div class="flex-1"></div>
|
||||
{#if profile.current?.user && isAdmin(profile.current.user)}
|
||||
<NavButton
|
||||
href="/admin"
|
||||
label={$t('nav.admin')}
|
||||
icon={ServerStack}
|
||||
class="relative"
|
||||
label={$t('nav.create.label')}
|
||||
icon={Plus}
|
||||
adaptive={false}
|
||||
color="primary"
|
||||
href="/create"
|
||||
isSelectedFilter={(path) => path.startsWith('/admin')}
|
||||
/>
|
||||
<Menu placement="bottom">
|
||||
{#snippet target(attachment)}
|
||||
<button
|
||||
{@attach attachment}
|
||||
class="w-10 h-10 rounded-full border-slate-200 dark:border-zinc-700
|
||||
{/if}
|
||||
{#if amModOfAny(profile.current?.user)}
|
||||
<NavButton
|
||||
href="/moderation"
|
||||
label={$t('nav.moderation')}
|
||||
class="relative"
|
||||
icon={ShieldCheck}
|
||||
/>
|
||||
{/if}
|
||||
<NavButton
|
||||
href="/explore/communities"
|
||||
label={$t('routes.explore.title')}
|
||||
icon={GlobeAlt}
|
||||
isSelectedFilter={(path) => path.startsWith('/explore')}
|
||||
/>
|
||||
<NavButton href="/search" label={$t('nav.search')} icon={MagnifyingGlass} />
|
||||
<NavButton
|
||||
label={$t('nav.create.label')}
|
||||
href="/create"
|
||||
isSelectedFilter={(path) => path.startsWith('/create')}
|
||||
icon={PencilSquare}
|
||||
alwaysShowIcon
|
||||
/>
|
||||
<Menu placement="bottom">
|
||||
{#snippet target(attachment)}
|
||||
<button
|
||||
{@attach attachment}
|
||||
class="w-10 h-10 rounded-full border-slate-200 dark:border-zinc-700
|
||||
transition-all bg-slate-50 dark:bg-zinc-900 relative
|
||||
hover:bg-slate-200 dark:hover:bg-zinc-700 group cursor-pointer"
|
||||
title={$t('profile.profile')}
|
||||
>
|
||||
{#if profile.current?.user}
|
||||
<div
|
||||
class="w-full h-full aspect-square object-cover rounded-full grid place-items-center group-hover:scale-90 transition-transform group-active:scale-[85%]"
|
||||
>
|
||||
<Avatar
|
||||
url={profile.current.user.local_user_view.person.avatar}
|
||||
width={36}
|
||||
alt={profile.current.user.local_user_view.person.name}
|
||||
/>
|
||||
</div>
|
||||
{:else}
|
||||
<div class="w-full h-full grid place-items-center">
|
||||
<Icon src={Bars3} micro size="18" />
|
||||
</div>
|
||||
{/if}
|
||||
{#if Math.max(...Object.values($notifications)) > 0}
|
||||
<div
|
||||
class="w-2 h-2 absolute top-0.5 right-0.5 bg-red-500 rounded-full"
|
||||
></div>
|
||||
{/if}
|
||||
</button>
|
||||
{/snippet}
|
||||
{#snippet children(open)}
|
||||
{#if open}
|
||||
{#await import('./Profile.svelte')}
|
||||
<div class="p-8 w-full h-full grid place-items-center">
|
||||
<Spinner width={20} />
|
||||
</div>
|
||||
{:then { default: Profile }}
|
||||
<Profile />
|
||||
{/await}
|
||||
title={$t('profile.profile')}
|
||||
>
|
||||
{#if profile.current?.user}
|
||||
<div
|
||||
class="w-full h-full aspect-square object-cover rounded-full grid place-items-center group-hover:scale-90 transition-transform group-active:scale-[85%]"
|
||||
>
|
||||
<Avatar
|
||||
url={profile.current.user.local_user_view.person.avatar}
|
||||
width={36}
|
||||
alt={profile.current.user.local_user_view.person.name}
|
||||
/>
|
||||
</div>
|
||||
{:else}
|
||||
<div class="w-full h-full grid place-items-center">
|
||||
<Icon src={Bars3} micro size="18" />
|
||||
</div>
|
||||
{/if}
|
||||
{/snippet}
|
||||
</Menu>
|
||||
</div>
|
||||
{#if Math.max(...Object.values($notifications)) > 0}
|
||||
<div
|
||||
class="w-2 h-2 absolute top-0.5 right-0.5 bg-red-500 rounded-full"
|
||||
></div>
|
||||
{/if}
|
||||
</button>
|
||||
{/snippet}
|
||||
{#snippet children(open)}
|
||||
{#if open}
|
||||
{#await import('./Profile.svelte')}
|
||||
<div class="p-8 w-full h-full grid place-items-center">
|
||||
<Spinner width={20} />
|
||||
</div>
|
||||
{:then { default: Profile }}
|
||||
<Profile />
|
||||
{/await}
|
||||
{/if}
|
||||
{/snippet}
|
||||
</Menu>
|
||||
</nav>
|
||||
@@ -15,6 +15,11 @@
|
||||
|
||||
let { data = $bindable() } = $props()
|
||||
|
||||
$effect(() => {
|
||||
if (data.filters.value.sort)
|
||||
settings.defaultSort.sort = data.filters.value.sort
|
||||
})
|
||||
|
||||
const FeedComponent = $derived(
|
||||
settings.infiniteScroll && browser && !settings.posts.noVirtualize
|
||||
? VirtualFeed
|
||||
|
||||
Reference in new issue
Block a user