impr: make mobile navbar tap targets more conventional
This commit is contained in:
3 files changed
+94
-47
No files matched your search
@@ -38,9 +38,8 @@
|
|||||||
<div class="min-h-screen flex flex-col">
|
<div class="min-h-screen flex flex-col">
|
||||||
<div
|
<div
|
||||||
class={[
|
class={[
|
||||||
'fixed lg:sticky bottom-0 lg:top-0',
|
'fixed md:sticky bottom-0 md:top-0',
|
||||||
!dockVisible && 'max-lg:-bottom-24',
|
!dockVisible && 'max-md:-bottom-24',
|
||||||
'max-w-3xl p-3 left-1/2 -translate-x-1/2 lg:max-w-full lg:p-0 lg:left-0 lg:translate-x-0',
|
|
||||||
'w-full z-50 pointer-events-none',
|
'w-full z-50 pointer-events-none',
|
||||||
]}
|
]}
|
||||||
style="transition: bottom .4s cubic-bezier(0.075, 0.82, 0.165, 1);"
|
style="transition: bottom .4s cubic-bezier(0.075, 0.82, 0.165, 1);"
|
||||||
@@ -49,8 +48,7 @@
|
|||||||
{@render navbar?.({
|
{@render navbar?.({
|
||||||
class: [
|
class: [
|
||||||
'bg-slate-100/70 dark:bg-zinc-950/90 border-slate-200/50 dark:border-zinc-900',
|
'bg-slate-100/70 dark:bg-zinc-950/90 border-slate-200/50 dark:border-zinc-900',
|
||||||
'pointer-events-auto backdrop-blur-xl border lg:border-t-0 lg:border-x-0',
|
'pointer-events-auto backdrop-blur-xl border md:border-t-0 md:border-x-0',
|
||||||
'rounded-full lg:rounded-none',
|
|
||||||
],
|
],
|
||||||
style: '',
|
style: '',
|
||||||
})}
|
})}
|
||||||
|
|||||||
@@ -48,18 +48,20 @@
|
|||||||
aria-selected={isSelected}
|
aria-selected={isSelected}
|
||||||
>
|
>
|
||||||
{#snippet prefix()}
|
{#snippet prefix()}
|
||||||
{#if icon}
|
<div class="prefix">
|
||||||
<div class="hidden lg:block">
|
{#if customIcon}
|
||||||
<Icon src={icon} size="16" micro />
|
{@render customIcon?.({ size: 16, isSelected })}
|
||||||
</div>
|
{:else if icon}
|
||||||
<div class="block lg:hidden">
|
<div class="hidden md:block">
|
||||||
<Icon src={icon} size="20" mini />
|
<Icon src={icon} size="16" micro />
|
||||||
</div>
|
</div>
|
||||||
{:else}
|
<div class="block md:hidden">
|
||||||
{@render customIcon?.({ size: 16, isSelected })}
|
<Icon src={icon} size="20" mini />
|
||||||
{/if}
|
</div>
|
||||||
|
{/if}
|
||||||
|
</div>
|
||||||
{/snippet}
|
{/snippet}
|
||||||
<span class="hidden {adaptive ? 'lg:block' : ''}">{label}</span>
|
<span class="hidden {adaptive ? 'md:block' : ''}">{label}</span>
|
||||||
{@render children?.()}
|
{@render children?.()}
|
||||||
</Button>
|
</Button>
|
||||||
|
|
||||||
@@ -67,10 +69,19 @@
|
|||||||
@reference '../../../../app.css';
|
@reference '../../../../app.css';
|
||||||
|
|
||||||
:global {
|
:global {
|
||||||
|
.prefix {
|
||||||
|
@variant max-md {
|
||||||
|
height: 100%;
|
||||||
|
display: grid;
|
||||||
|
place-items: center;
|
||||||
|
aspect-ratio: 1 / 1;
|
||||||
|
border-radius: 100%;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
.nav-btn {
|
.nav-btn {
|
||||||
width: calc(var(--spacing) * 10);
|
width: calc(var(--spacing) * 10);
|
||||||
height: calc(var(--spacing) * 10);
|
height: calc(var(--spacing) * 10);
|
||||||
border-radius: 9999px;
|
|
||||||
|
|
||||||
color: var(--color-slate-500);
|
color: var(--color-slate-500);
|
||||||
|
|
||||||
@@ -89,7 +100,7 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
.nav-btn-dynamic {
|
.nav-btn-dynamic {
|
||||||
@variant lg {
|
@variant md {
|
||||||
width: max-content;
|
width: max-content;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -100,10 +111,31 @@
|
|||||||
color: var(--color-primary-100);
|
color: var(--color-primary-100);
|
||||||
}
|
}
|
||||||
|
|
||||||
@variant max-lg {
|
@variant max-md {
|
||||||
background-color: var(--color-slate-200);
|
.prefix {
|
||||||
|
background-color: var(--color-slate-200);
|
||||||
|
@variant dark {
|
||||||
|
background-color: var(--color-zinc-800);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@variant max-md {
|
||||||
|
.nav-btn-sm-primary .prefix {
|
||||||
|
background-color: var(--color-primary-900);
|
||||||
|
color: var(--color-slate-50);
|
||||||
|
|
||||||
|
@variant hover {
|
||||||
|
color: initial;
|
||||||
|
}
|
||||||
|
|
||||||
@variant dark {
|
@variant dark {
|
||||||
background-color: var(--color-zinc-800);
|
background-color: var(--color-primary-100);
|
||||||
|
color: var(--color-zinc-900);
|
||||||
|
@variant hover {
|
||||||
|
color: initial;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -9,6 +9,7 @@
|
|||||||
import {
|
import {
|
||||||
Bars3,
|
Bars3,
|
||||||
GlobeAlt,
|
GlobeAlt,
|
||||||
|
Home,
|
||||||
Icon,
|
Icon,
|
||||||
MagnifyingGlass,
|
MagnifyingGlass,
|
||||||
PencilSquare,
|
PencilSquare,
|
||||||
@@ -33,8 +34,8 @@
|
|||||||
<nav
|
<nav
|
||||||
class={[
|
class={[
|
||||||
'w-full mx-auto z-50',
|
'w-full mx-auto z-50',
|
||||||
'lg:gap-5 gap-2 flex flex-row items-center p-2',
|
'md:gap-5 gap-2 flex flex-row items-center justify-between p-2',
|
||||||
'box-border p-0.5 duration-150 @container',
|
'box-border p-0.5 duration-150 @container *:max-md:flex-1',
|
||||||
clazz,
|
clazz,
|
||||||
]}
|
]}
|
||||||
{style}
|
{style}
|
||||||
@@ -45,9 +46,10 @@
|
|||||||
promptOpen = true
|
promptOpen = true
|
||||||
return true
|
return true
|
||||||
}}
|
}}
|
||||||
|
icon={Home}
|
||||||
href="/"
|
href="/"
|
||||||
label={$t('nav.home')}
|
label={$t('nav.home')}
|
||||||
class="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 md:rounded-full! md:w-10! md:h-10 md:px-0! text-primary-900! dark:text-primary-100! -order-1"
|
||||||
adaptive={false}
|
adaptive={false}
|
||||||
>
|
>
|
||||||
{#snippet customIcon()}
|
{#snippet customIcon()}
|
||||||
@@ -67,55 +69,70 @@
|
|||||||
{/if}
|
{/if}
|
||||||
{/snippet}
|
{/snippet}
|
||||||
</NavButton>
|
</NavButton>
|
||||||
<div class="flex-1"></div>
|
<div class="hidden md:block md:flex-1"></div>
|
||||||
{#if profile.current?.user && isAdmin(profile.current.user)}
|
<div class="sr-only md:not-sr-only md:contents">
|
||||||
<NavButton
|
{#if profile.current?.user && isAdmin(profile.current.user)}
|
||||||
href="/admin"
|
<NavButton
|
||||||
label={$t('nav.admin')}
|
href="/admin"
|
||||||
icon={ServerStack}
|
label={$t('nav.admin')}
|
||||||
class="relative"
|
icon={ServerStack}
|
||||||
isSelectedFilter={(path) => path.startsWith('/admin')}
|
class="relative order-0"
|
||||||
/>
|
isSelectedFilter={(path) => path.startsWith('/admin')}
|
||||||
{/if}
|
/>
|
||||||
{#if amModOfAny(profile.current?.user)}
|
{/if}
|
||||||
<NavButton
|
{#if amModOfAny(profile.current?.user)}
|
||||||
href="/moderation"
|
<NavButton
|
||||||
label={$t('nav.moderation')}
|
href="/moderation"
|
||||||
class="relative"
|
label={$t('nav.moderation')}
|
||||||
icon={ShieldCheck}
|
class="relative order-0"
|
||||||
/>
|
icon={ShieldCheck}
|
||||||
{/if}
|
/>
|
||||||
|
{/if}
|
||||||
|
</div>
|
||||||
<NavButton
|
<NavButton
|
||||||
href="/explore/communities"
|
href="/explore/communities"
|
||||||
label={$t('routes.explore.title')}
|
label={$t('routes.explore.title')}
|
||||||
icon={GlobeAlt}
|
icon={GlobeAlt}
|
||||||
isSelectedFilter={(path) => path.startsWith('/explore')}
|
isSelectedFilter={(path) => path.startsWith('/explore')}
|
||||||
|
class="order-1"
|
||||||
|
/>
|
||||||
|
<NavButton
|
||||||
|
href="/search"
|
||||||
|
label={$t('nav.search')}
|
||||||
|
icon={MagnifyingGlass}
|
||||||
|
class="order-3 md:order-2"
|
||||||
/>
|
/>
|
||||||
<NavButton href="/search" label={$t('nav.search')} icon={MagnifyingGlass} />
|
|
||||||
<NavButton
|
<NavButton
|
||||||
label={$t('nav.create.label')}
|
label={$t('nav.create.label')}
|
||||||
href="/create"
|
href="/create"
|
||||||
isSelectedFilter={(path) => path.startsWith('/create')}
|
isSelectedFilter={(path) => path.startsWith('/create')}
|
||||||
icon={PencilSquare}
|
icon={PencilSquare}
|
||||||
|
class="order-2 md:order-3 nav-btn-sm-primary"
|
||||||
alwaysShowIcon
|
alwaysShowIcon
|
||||||
/>
|
/>
|
||||||
<Menu placement="bottom">
|
<Menu placement="bottom">
|
||||||
{#snippet target(attachment)}
|
{#snippet target(attachment)}
|
||||||
<button
|
<button
|
||||||
{@attach attachment}
|
{@attach attachment}
|
||||||
class="w-10 h-10 rounded-full border-slate-200 dark:border-zinc-700
|
class={[
|
||||||
transition-all bg-slate-50 dark:bg-zinc-900 relative
|
'w-10 h-10 rounded-full',
|
||||||
hover:bg-slate-200 dark:hover:bg-zinc-700 group cursor-pointer"
|
'transition-all relative grid place-items-center',
|
||||||
|
' group cursor-pointer order-4',
|
||||||
|
]}
|
||||||
title={$t('profile.profile')}
|
title={$t('profile.profile')}
|
||||||
>
|
>
|
||||||
{#if profile.current?.user}
|
{#if profile.current?.user}
|
||||||
<div
|
<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%]"
|
class={[
|
||||||
|
'h-full aspect-square object-cover rounded-full grid place-items-center',
|
||||||
|
'border-slate-200 dark:border-zinc-700 hover:bg-slate-200 dark:hover:bg-zinc-700 bg-slate-50 dark:bg-zinc-900',
|
||||||
|
]}
|
||||||
>
|
>
|
||||||
<Avatar
|
<Avatar
|
||||||
url={profile.current.user.local_user_view.person.avatar}
|
url={profile.current.user.local_user_view.person.avatar}
|
||||||
width={36}
|
width={36}
|
||||||
alt={profile.current.user.local_user_view.person.name}
|
alt={profile.current.user.local_user_view.person.name}
|
||||||
|
class="group-hover:scale-90 transition-transform group-active:scale-85"
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
{:else}
|
{:else}
|
||||||
|
|||||||
Reference in new issue
Block a user