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 { SupabaseClient } from '@supabase/supabase-js';
|
||||
import SignOut from '../SignOut.svelte';
|
||||
import { page } from '$app/stores';
|
||||
|
||||
export let linkItem: NavLinkItem;
|
||||
export let supabase: SupabaseClient | null = null;
|
||||
</script>
|
||||
|
||||
{#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}
|
||||
<SignOut {supabase} />
|
||||
{/if}
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
import type { Session } from '@supabase/supabase-js';
|
||||
import NavLinkParent from './NavLinkParent.svelte';
|
||||
import type SupabaseClient from '@supabase/supabase-js/dist/module/SupabaseClient';
|
||||
import NavLink from './NavLink.svelte';
|
||||
|
||||
export let session: Session | null;
|
||||
export let supabase: SupabaseClient | null = null;
|
||||
@@ -68,7 +69,7 @@
|
||||
{#if link.isParent}
|
||||
<NavLinkParent linkItem={link} {isMobile} {supabase} />
|
||||
{:else}
|
||||
<a href={link.href}>{link.text}</a>
|
||||
<NavLink linkItem={link} />
|
||||
{/if}
|
||||
</li>
|
||||
{/each}
|
||||
|
||||
Reference in New Issue
Block a user