feat(web): small responsivness improvements regarding mobile use (#2255)

* make sidebar load more fluid
use css before js kicks in
added xs breakpoint in tailwind config

* fix sidebar hr still showing if opened

* make share tab not overflow on mobile

* make user management tab responsive

* make jobs panel responsive

* fix format in tailwind config

* fix full width on large screens
use md breakpoint for w-[800px]

* show accessible name for all screens

* replace grid with flex-col

* replace all xs with sm

* remove isCollapsed completly
using only tailwinds group feature and sm and md breakpoints

* remove leftovers of isCollapsed
and make the settings content less stretched

* remove isCollapsed in layout and side-bar

* fix code style

---------

Co-authored-by: faupau03 <paul.paffe@gmx.net>
Co-authored-by: Alex <alex.tran1502@gmail.com>
This commit is contained in:
faupau 2023-04-17 18:18:49 +02:00 committed by GitHub
parent 1e32a5fffd
commit b970a40b4e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
10 changed files with 128 additions and 114 deletions

View file

@ -7,7 +7,6 @@
export let title: string;
export let logo: typeof Icon;
export let isSelected: boolean;
export let isCollapsed: boolean;
let showMoreInformation = false;
@ -22,18 +21,18 @@
{isSelected
? 'bg-immich-primary/10 dark:bg-immich-dark-primary/10 text-immich-primary dark:text-[#adcbfa] hover:bg-immich-primary/25'
: ''}
{isCollapsed ? 'pl-5' : 'px-5'}
pl-5 group-hover:sm:px-5 md:px-5
"
>
<div class="flex gap-4 place-items-center w-full overflow-hidden">
<div class="flex gap-4 place-items-center w-full overflow-hidden truncate">
<svelte:component this={logo} size="1.5em" class="shrink-0" />
<p class="font-medium text-sm">{title}</p>
</div>
<div
class="transition-[height] duration-100 delay-200 {isCollapsed ? 'height-0' : 'height-auto'}"
class="transition-[height] group-hover:sm:overflow-visible md:overflow-visible overflow-hidden duration-100 delay-1000 sm:group-hover:h-auto md:h-auto h-0"
>
{#if $$slots.moreInformation && !isCollapsed}
{#if $$slots.moreInformation}
<div
class="relative flex justify-center select-none cursor-default"
on:mouseenter={() => (showMoreInformation = true)}

View file

@ -1,32 +1,9 @@
<script lang="ts">
import { onMount } from 'svelte';
export let isCollapsed = true;
let innerWidth: number;
const handleResize = () => {
if (innerWidth > 768) {
isCollapsed = false;
} else {
isCollapsed = true;
}
};
onMount(() => {
handleResize();
});
</script>
<svelte:window on:resize={handleResize} bind:innerWidth />
<section
id="sidebar"
on:mouseover={() => (innerWidth >= 430 ? (isCollapsed = false) : null)}
on:focus={() => (innerWidth >= 430 ? (isCollapsed = false) : null)}
on:mouseleave={() => handleResize()}
class="flex flex-col gap-1 pt-8 bg-immich-bg dark:bg-immich-dark-bg transition-[width] duration-200 z-10 {isCollapsed
? 'w-[72px]'
: 'pr-6 w-64 shadow-2xl md:shadow-none md:border-none border-r dark:border-r-immich-dark-gray'}"
class="group flex flex-col gap-1 pt-8 bg-immich-bg dark:bg-immich-dark-bg transition-all duration-200 z-10 w-[72px] md:w-64 hover:sm:pr-6 md:pr-6 hover:sm:w-64 hover:sm:shadow-2xl hover:md:shadow-none hover:md:border-none hover:sm:border-r hover:sm:dark:border-r-immich-dark-gray"
>
<slot />
</section>

View file

@ -14,8 +14,6 @@
import { locale } from '$lib/stores/preferences.store';
import SideBarSection from './side-bar-section.svelte';
let isCollapsed: boolean;
const getAssetCount = async () => {
const { data: allAssetCount } = await api.assetApi.getAssetCountByUserId();
const { data: archivedCount } = await api.assetApi.getArchivedAssetCountByUserId();
@ -74,7 +72,7 @@
};
</script>
<SideBarSection bind:isCollapsed>
<SideBarSection>
<a
data-sveltekit-preload-data="hover"
data-sveltekit-noscroll
@ -85,7 +83,6 @@
title="Photos"
logo={ImageOutline}
isSelected={$page.route.id === '/(user)/photos'}
{isCollapsed}
>
<svelte:fragment slot="moreInformation">
{#await getAssetCount()}
@ -109,7 +106,6 @@
title="Explore"
logo={Magnify}
isSelected={$page.route.id === '/(user)/explore'}
{isCollapsed}
/>
</a>
<a data-sveltekit-preload-data="hover" href={AppRoute.SHARING} draggable="false">
@ -117,7 +113,6 @@
title="Sharing"
logo={AccountMultipleOutline}
isSelected={$page.route.id === '/(user)/sharing'}
{isCollapsed}
>
<svelte:fragment slot="moreInformation">
{#await getAlbumCount()}
@ -131,18 +126,15 @@
</SideBarButton>
</a>
<div
class="text-xs md:pb-2 md:p-5 p-6 pb-[1.2rem] dark:text-immich-dark-fg transition-all duration-200"
>
<p class={isCollapsed ? 'hidden' : 'block'}>LIBRARY</p>
<hr class={isCollapsed ? 'block mt-2 mb-[0.45rem]' : 'hidden'} />
<div class="text-xs dark:text-immich-dark-fg transition-all duration-200">
<p class="p-6 hidden md:block group-hover:sm:block">LIBRARY</p>
<hr class="mt-8 mb-[31px] mx-4 block md:hidden group-hover:sm:hidden" />
</div>
<a data-sveltekit-preload-data="hover" href={AppRoute.FAVORITES} draggable="false">
<SideBarButton
title="Favorites"
logo={StarOutline}
isSelected={$page.route.id == '/(user)/favorites'}
{isCollapsed}
>
<svelte:fragment slot="moreInformation">
{#await getFavoriteCount()}
@ -160,7 +152,6 @@
title="Albums"
logo={ImageAlbum}
isSelected={$page.route.id === '/(user)/albums'}
{isCollapsed}
>
<svelte:fragment slot="moreInformation">
{#await getAlbumCount()}
@ -178,7 +169,6 @@
title="Archive"
logo={ArchiveArrowDownOutline}
isSelected={$page.route.id === '/(user)/archive'}
{isCollapsed}
>
<svelte:fragment slot="moreInformation">
{#await getArchivedAssetsCount()}
@ -195,6 +185,6 @@
<!-- Status Box -->
<div class="mb-6 mt-auto">
<StatusBox {isCollapsed} />
<StatusBox />
</div>
</SideBarSection>