mirror of
https://github.com/immich-app/immich.git
synced 2025-01-21 00:52:43 -05:00
feat(web): add skip link to sidebar (#12330)
Co-authored-by: Alex <alex.tran1502@gmail.com>
This commit is contained in:
parent
ce2349d496
commit
c5848112bb
6 changed files with 20 additions and 10 deletions
|
@ -1,10 +1,12 @@
|
|||
<script lang="ts">
|
||||
import { t } from 'svelte-i18n';
|
||||
import Button from './button.svelte';
|
||||
|
||||
/**
|
||||
* Target for the skip link to move focus to.
|
||||
*/
|
||||
export let target: string = 'main';
|
||||
export let text: string = $t('skip_to_content');
|
||||
|
||||
let isFocused = false;
|
||||
|
||||
|
@ -22,6 +24,6 @@
|
|||
on:focus={() => (isFocused = true)}
|
||||
on:blur={() => (isFocused = false)}
|
||||
>
|
||||
<slot />
|
||||
{text}
|
||||
</Button>
|
||||
</div>
|
||||
|
|
|
@ -1,3 +1,7 @@
|
|||
<script lang="ts" context="module">
|
||||
export const headerId = 'user-page-header';
|
||||
</script>
|
||||
|
||||
<script lang="ts">
|
||||
import { openFileUploadDialog } from '$lib/utils/file-uploader';
|
||||
import NavigationBar from '../shared-components/navigation-bar/navigation-bar.svelte';
|
||||
|
@ -35,16 +39,14 @@
|
|||
</slot>
|
||||
|
||||
<section class="relative">
|
||||
{#if title || $$slots.title || $$slots.buttons}
|
||||
{#if title || $$slots.buttons}
|
||||
<div
|
||||
class="absolute flex h-16 w-full place-items-center justify-between border-b p-4 dark:border-immich-dark-gray dark:text-immich-dark-fg"
|
||||
>
|
||||
<div class="flex gap-2 items-center">
|
||||
<slot name="title">
|
||||
{#if title}
|
||||
<div class="font-medium">{title}</div>
|
||||
{/if}
|
||||
</slot>
|
||||
{#if title}
|
||||
<div class="font-medium" tabindex="-1" id={headerId}>{title}</div>
|
||||
{/if}
|
||||
{#if description}
|
||||
<p class="text-sm text-gray-400 dark:text-gray-600">{description}</p>
|
||||
{/if}
|
||||
|
|
|
@ -46,7 +46,7 @@
|
|||
<svelte:window bind:innerWidth />
|
||||
|
||||
<section id="dashboard-navbar" class="fixed z-[900] h-[var(--navbar-height)] w-screen text-sm">
|
||||
<SkipLink>{$t('skip_to_content')}</SkipLink>
|
||||
<SkipLink text={$t('skip_to_content')} />
|
||||
<div
|
||||
class="grid h-full grid-cols-[theme(spacing.18)_auto] items-center border-b bg-immich-bg py-2 dark:border-b-immich-dark-gray dark:bg-immich-dark-bg md:grid-cols-[theme(spacing.64)_auto]"
|
||||
>
|
||||
|
|
|
@ -1144,6 +1144,8 @@
|
|||
"sign_up": "Sign up",
|
||||
"size": "Size",
|
||||
"skip_to_content": "Skip to content",
|
||||
"skip_to_folders": "Skip to folders",
|
||||
"skip_to_tags": "Skip to tags",
|
||||
"slideshow": "Slideshow",
|
||||
"slideshow_settings": "Slideshow settings",
|
||||
"sort_albums_by": "Sort albums by...",
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
<script lang="ts">
|
||||
import { goto } from '$app/navigation';
|
||||
import { page } from '$app/stores';
|
||||
import UserPageLayout from '$lib/components/layouts/user-page-layout.svelte';
|
||||
import UserPageLayout, { headerId } from '$lib/components/layouts/user-page-layout.svelte';
|
||||
import GalleryViewer from '$lib/components/shared-components/gallery-viewer/gallery-viewer.svelte';
|
||||
import SideBarSection from '$lib/components/shared-components/side-bar/side-bar-section.svelte';
|
||||
import TreeItemThumbnails from '$lib/components/shared-components/tree/tree-item-thumbnails.svelte';
|
||||
|
@ -16,6 +16,7 @@
|
|||
import { t } from 'svelte-i18n';
|
||||
import type { PageData } from './$types';
|
||||
import Breadcrumbs from '$lib/components/shared-components/tree/breadcrumbs.svelte';
|
||||
import SkipLink from '$lib/components/elements/buttons/skip-link.svelte';
|
||||
|
||||
export let data: PageData;
|
||||
|
||||
|
@ -48,6 +49,7 @@
|
|||
|
||||
<UserPageLayout title={data.meta.title}>
|
||||
<SideBarSection slot="sidebar">
|
||||
<SkipLink target={`#${headerId}`} text={$t('skip_to_folders')} />
|
||||
<section>
|
||||
<div class="text-xs pl-4 mb-2 dark:text-white">{$t('explorer').toUpperCase()}</div>
|
||||
<div class="h-full">
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
import Button from '$lib/components/elements/buttons/button.svelte';
|
||||
import LinkButton from '$lib/components/elements/buttons/link-button.svelte';
|
||||
import Icon from '$lib/components/elements/icon.svelte';
|
||||
import UserPageLayout from '$lib/components/layouts/user-page-layout.svelte';
|
||||
import UserPageLayout, { headerId } from '$lib/components/layouts/user-page-layout.svelte';
|
||||
import AssetGrid from '$lib/components/photos-page/asset-grid.svelte';
|
||||
import FullScreenModal from '$lib/components/shared-components/full-screen-modal.svelte';
|
||||
import {
|
||||
|
@ -27,6 +27,7 @@
|
|||
import type { PageData } from './$types';
|
||||
import { dialogController } from '$lib/components/shared-components/dialog/dialog';
|
||||
import Breadcrumbs from '$lib/components/shared-components/tree/breadcrumbs.svelte';
|
||||
import SkipLink from '$lib/components/elements/buttons/skip-link.svelte';
|
||||
|
||||
export let data: PageData;
|
||||
|
||||
|
@ -132,6 +133,7 @@
|
|||
|
||||
<UserPageLayout title={data.meta.title} scrollbar={false}>
|
||||
<SideBarSection slot="sidebar">
|
||||
<SkipLink target={`#${headerId}`} text={$t('skip_to_tags')} />
|
||||
<section>
|
||||
<div class="text-xs pl-4 mb-2 dark:text-white">{$t('explorer').toUpperCase()}</div>
|
||||
<div class="h-full">
|
||||
|
|
Loading…
Add table
Reference in a new issue