mirror of
https://github.com/jcreek/SvelteKitSaasBoilerplate.git
synced 2026-07-13 11:03:49 +00:00
refactor(#35): nav links to be accessible
This commit is contained in:
@@ -2,13 +2,14 @@
|
|||||||
import type { NavLinkItem } from '$lib/types/Nav/NavLinkItem';
|
import type { NavLinkItem } from '$lib/types/Nav/NavLinkItem';
|
||||||
import type { SupabaseClient } from '@supabase/supabase-js';
|
import type { SupabaseClient } from '@supabase/supabase-js';
|
||||||
import SignOut from '../SignOut.svelte';
|
import SignOut from '../SignOut.svelte';
|
||||||
|
import { page } from '$app/stores';
|
||||||
|
|
||||||
export let linkItem: NavLinkItem;
|
export let linkItem: NavLinkItem;
|
||||||
export let supabase: SupabaseClient | null = null;
|
export let supabase: SupabaseClient | null = null;
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
{#if !linkItem.isSignout}
|
{#if !linkItem.isSignout}
|
||||||
<a href={linkItem.href}>{linkItem.text}</a>
|
<a role="menuitem" href={linkItem.href} aria-current={linkItem.href === $page.url.pathname ? 'page' : undefined}>{linkItem.text}</a>
|
||||||
{:else if supabase && linkItem.isSignout}
|
{:else if supabase && linkItem.isSignout}
|
||||||
<SignOut {supabase} />
|
<SignOut {supabase} />
|
||||||
{/if}
|
{/if}
|
||||||
|
|||||||
@@ -3,6 +3,7 @@
|
|||||||
import type { Session } from '@supabase/supabase-js';
|
import type { Session } from '@supabase/supabase-js';
|
||||||
import NavLinkParent from './NavLinkParent.svelte';
|
import NavLinkParent from './NavLinkParent.svelte';
|
||||||
import type SupabaseClient from '@supabase/supabase-js/dist/module/SupabaseClient';
|
import type SupabaseClient from '@supabase/supabase-js/dist/module/SupabaseClient';
|
||||||
|
import NavLink from './NavLink.svelte';
|
||||||
|
|
||||||
export let session: Session | null;
|
export let session: Session | null;
|
||||||
export let supabase: SupabaseClient | null = null;
|
export let supabase: SupabaseClient | null = null;
|
||||||
@@ -68,7 +69,7 @@
|
|||||||
{#if link.isParent}
|
{#if link.isParent}
|
||||||
<NavLinkParent linkItem={link} {isMobile} {supabase} />
|
<NavLinkParent linkItem={link} {isMobile} {supabase} />
|
||||||
{:else}
|
{:else}
|
||||||
<a href={link.href}>{link.text}</a>
|
<NavLink linkItem={link} />
|
||||||
{/if}
|
{/if}
|
||||||
</li>
|
</li>
|
||||||
{/each}
|
{/each}
|
||||||
|
|||||||
Reference in New Issue
Block a user