fix(#103): move language switcher from header into mobile nav drawer
On mobile the header is now cleaner — language buttons move to the bottom of the hamburger panel. Desktop header is unchanged (sm:flex). Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -46,8 +46,8 @@ const userInitials = $derived.by(() => {
|
||||
|
||||
<!-- Right Side -->
|
||||
<div class="flex items-center gap-3">
|
||||
<!-- Language selector -->
|
||||
<div class="flex items-center gap-1 border-r border-line pr-3">
|
||||
<!-- Language selector (desktop only — mobile lives in nav drawer) -->
|
||||
<div class="hidden items-center gap-1 border-r border-line pr-3 sm:flex">
|
||||
{#each locales as locale (locale)}
|
||||
<button
|
||||
type="button"
|
||||
|
||||
@@ -2,9 +2,14 @@
|
||||
import { page } from '$app/state';
|
||||
import { untrack } from 'svelte';
|
||||
import { m } from '$lib/paraglide/messages.js';
|
||||
import { setLocale, getLocale } from '$lib/paraglide/runtime';
|
||||
|
||||
let { isAdmin = false }: { isAdmin?: boolean } = $props();
|
||||
|
||||
const locales = ['DE', 'EN', 'ES'] as const;
|
||||
const localeMap = { DE: 'de', EN: 'en', ES: 'es' } as const;
|
||||
const activeLocale = $derived(getLocale().toUpperCase());
|
||||
|
||||
let mobileNavOpen = $state(false);
|
||||
|
||||
$effect(() => {
|
||||
@@ -180,6 +185,22 @@ function handleOverlayKeydown(event: KeyboardEvent) {
|
||||
{m.nav_admin()}
|
||||
</a>
|
||||
{/if}
|
||||
|
||||
<!-- Language switcher -->
|
||||
<div class="flex items-center gap-2 border-t border-line px-4 py-3">
|
||||
{#each locales as locale (locale)}
|
||||
<button
|
||||
type="button"
|
||||
onclick={() => setLocale(localeMap[locale])}
|
||||
class="min-h-[44px] px-3 font-sans text-sm tracking-widest transition-colors
|
||||
{activeLocale === locale
|
||||
? 'font-bold text-ink'
|
||||
: 'font-normal text-ink-3 hover:text-ink'}"
|
||||
>
|
||||
{locale}
|
||||
</button>
|
||||
{/each}
|
||||
</div>
|
||||
</nav>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user