feat: responsive sidebar, aim for a 600px timeline always (#482)

zio/stable
patak 2022-12-21 01:02:01 +01:00 committed by GitHub
parent 3907199a54
commit 44cf8aa89c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 29 additions and 39 deletions

View File

@ -22,7 +22,7 @@ defineProps<{
</div>
<div flex items-center flex-shrink-0 gap-x-2>
<slot name="actions" />
<NavUser v-if="isHydrated && isMediumScreen" />
<NavUser v-if="isHydrated" sm:hidden />
</div>
</div>
<slot name="header" />

View File

@ -3,7 +3,7 @@ const { notifications } = useNotifications()
</script>
<template>
<nav md:px3 md:py4 flex="~ col gap2" text-size-base leading-normal md:text-lg>
<nav sm:px3 sm:py4 flex="~ col gap2" text-size-base leading-normal md:text-lg>
<template v-if="isMastoInitialised && currentUser">
<NavSideItem :text="$t('nav_side.home')" to="/home" icon="i-ri:home-5-line" />
<NavSideItem :text="$t('nav_side.notifications')" to="/notifications" icon="i-ri:notification-4-line">
@ -24,20 +24,6 @@ const { notifications } = useNotifications()
<NavSideItem :text="$t('nav_side.conversations')" to="/conversations" icon="i-ri:at-line" />
<NavSideItem :text="$t('nav_side.favourites')" to="/favourites" icon="i-ri:heart-3-line" />
<NavSideItem :text="$t('nav_side.bookmarks')" to="/bookmarks" icon="i-ri:bookmark-line " />
<NavSideItem
v-if="isHydrated && isMediumScreen"
:text="currentUser.account.displayName"
:to="getAccountRoute(currentUser.account)"
icon="i-ri:account-circle-line"
>
<template #icon>
<AccountAvatar :account="currentUser.account" h="1.2em" md:text-size-inherit text-xl />
</template>
<ContentRich
:content="getDisplayName(currentUser.account, { rich: true }) || $t('nav_side.profile')"
:emojis="currentUser.account.emojis"
/>
</NavSideItem>
</template>
</nav>
</template>

View File

@ -26,13 +26,15 @@ useCommand({
<template>
<NuxtLink :to="to" :active-class="isMastoInitialised ? 'text-primary' : ''" group focus:outline-none @click="$scrollToTop">
<div flex w-fit px5 py2 md:gap2 gap4 items-center transition-100 rounded-full group-hover:bg-active group-focus-visible:ring="2 current">
<CommonTooltip :disabled="!isMediumScreen" :content="text" placement="right">
<div flex w-fit px2 mx3 lg:mx0 lg:px5 py2 gap4 items-center transition-100 rounded-full group-hover:bg-active group-focus-visible:ring="2 current">
<slot name="icon">
<div :class="icon" md:text-size-inherit text-xl />
<div :class="icon" text-xl />
</slot>
<slot>
<span>{{ text }}</span>
<span hidden lg:block>{{ text }}</span>
</slot>
</div>
</CommonTooltip>
</NuxtLink>
</template>

View File

@ -7,7 +7,7 @@ const sub = env === 'local' ? 'dev' : env === 'staging' ? 'preview' : 'alpha'
<!-- Use external to force refresh page and jump to top of timeline -->
<NuxtLink flex px3 py2 items-center text-2xl gap-2 hover:bg-active focus-visible:ring="2 current" rounded-full to="/" external>
<img :alt="$t('app_logo')" src="/logo.svg" w-10 h-10 height="40" width="40">
<div>
<div hidden lg:block>
{{ $t('app_name') }} <sup text-sm italic text-secondary mt-1>{{ sub }}</sup>
</div>
</NuxtLink>

View File

@ -1,6 +1,6 @@
<template>
<button btn-outline rounded-full font-bold py4 flex="~ gap2 center" @click="openPublishDialog()">
<button color-primary btn-outline rounded-full ml-7 lg:ml-3 w-9 lg:w-auto font-bold py2 lg:py4 flex="~ gap2 center" @click="openPublishDialog()">
<div i-ri:quill-pen-line />
{{ $t('action.compose') }}
<span hidden lg:block>{{ $t('action.compose') }}</span>
</button>
</template>

View File

@ -1,11 +1,11 @@
<template>
<div h-full :class="{ zen: isZenMode }">
<div v-if="isMastoInitialised" v-show="showUserSwitcherSidebar" fixed h-full hidden md:block bg-code border-r-1 border-base>
<div v-if="isMastoInitialised" v-show="showUserSwitcherSidebar" fixed h-full hidden lg:block bg-code border-r-1 border-base>
<UserPicker />
</div>
<main flex w-full mxa lg:max-w-80rem :class="isMastoInitialised && showUserSwitcherSidebar ? 'md:pl-20' : ''">
<aside class="hidden md:block w-1/4 zen-hide" relative>
<div sticky top-0 h-screen flex="~ col">
<main flex w-full mxa lg:max-w-80rem :class="isMastoInitialised && showUserSwitcherSidebar ? 'lg:pl-20' : ''">
<aside class="hidden sm:flex w-1/8 md:w-1/6 justify-end lg:w-1/4 zen-hide" relative>
<div sticky top-0 w-20 lg:w-auto h-screen flex="~ col">
<slot name="left">
<NavTitle mx3 mt4 mb2 self-start />
<div flex="~ col" overflow-y-auto justify-between h-full>
@ -15,9 +15,10 @@
</div>
<div flex flex-col>
<UserSignInEntry v-if="isMastoInitialised && !currentUser" />
<div v-if="isMastoInitialised && currentUser" py6 px4 w-full flex="~" items-center justify-between>
<div v-if="isMastoInitialised && currentUser" p6 pb8 w-full flex="~" items-center justify-between>
<NuxtLink
p2 rounded-full text-start w-full
v-if="!isMediumScreen"
rounded-full text-start w-full
hover:bg-active cursor-pointer transition-100
:to="getAccountRoute(currentUser.account)"
>
@ -25,7 +26,8 @@
</NuxtLink>
<VDropdown :distance="0" placement="bottom-end">
<button btn-action-icon :aria-label="$t('action.switch_account')">
<div i-ri:more-2-line />
<div v-if="!isMediumScreen" i-ri:more-2-line />
<AccountAvatar v-else :account="currentUser.account" w-9 h-9 />
</button>
<template #popper="{ hide }">
<UserSwitcher @click="hide" />
@ -37,16 +39,16 @@
</slot>
</div>
</aside>
<div class="w-full mb14 md:(w-3/4 mb0) lg:(w-2/4 mb0) min-h-screen" border="none md:l md:r base">
<div class="w-full mb14 sm:(w-600px mb0) min-h-screen" border="none sm:l sm:r base">
<div min-h-screen>
<slot />
</div>
<div sticky left-0 right-0 bottom-0 z-10 bg-base pb="[env(safe-area-inset-bottom)]" transition="padding 20">
<CommonOfflineChecker :small-screen="isHydrated && isSmallScreen" />
<NavBottom v-if="isHydrated && isSmallScreen" />
<div sm:hidden sticky left-0 right-0 bottom-0 z-10 bg-base pb="[env(safe-area-inset-bottom)]" transition="padding 20">
<CommonOfflineChecker :small-screen="isHydrated" />
<NavBottom v-if="isHydrated" />
</div>
</div>
<aside class="hidden md:none lg:block w-1/4 zen-hide">
<aside class="hidden sm:none lg:block w-1/4 zen-hide">
<div sticky top-0 h-screen flex="~ col" py3>
<slot name="right">
<SearchWidget v-if="isMastoInitialised" />