Files
Toiminnanohjaus/resources/views/layouts/app.blade.php
T
petriandClaude Opus 5.5 7b6a909677 Add light/dark theme toggle remembered in the browser
- New partial resources/views/partials/theme-toggle.blade.php: a Flux
  button that flips $flux.dark. Flux stores the choice in localStorage
  (flux.appearance) and applies it before the page paints; until the
  user chooses, the system theme is followed.
- Shown in the header for signed-in users and at the top right of the
  guest pages.
- Accessible: stable name "Tumma teema" with a tooltip, state in
  aria-pressed, decorative moon/sun icons.
- Browser tests cover toggling, persistence across pages, overriding a
  dark system theme, keyboard use and axe checks in both themes.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-11-22 11:25:01 +02:00

72 lines
3.0 KiB
PHP

<!DOCTYPE html>
<html lang="{{ str_replace('_', '-', app()->getLocale()) }}">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>{{ $title ?? config('app.name') }}</title>
<link rel="preconnect" href="https://fonts.bunny.net">
<link href="https://fonts.bunny.net/css?family=inter:400,500,600&display=swap" rel="stylesheet" />
@vite(['resources/css/app.css', 'resources/js/app.js'])
@livewireStyles
@fluxAppearance
</head>
<body class="min-h-screen bg-white antialiased dark:bg-zinc-800">
<a
href="#main-content"
class="sr-only focus:not-sr-only focus:fixed focus:start-4 focus:top-4 focus:z-50 focus:rounded-md focus:bg-white focus:px-4 focus:py-2 focus:text-zinc-900 focus:shadow-lg focus:outline-2 focus:outline-offset-2 focus:outline-blue-700"
>
{{ __('layout.skip_to_content') }}
</a>
@auth
<header class="border-b border-zinc-200 dark:border-zinc-700">
<div class="mx-auto flex max-w-5xl flex-wrap items-center gap-x-6 gap-y-2 px-4 py-3 sm:px-6">
<flux:link :href="route('home')" wire:navigate variant="subtle" class="font-semibold">
{{ config('app.name') }}
</flux:link>
<flux:navbar :aria-label="__('layout.main_menu')" class="flex-1 py-0">
<flux:navbar.item :href="route('customers.index')" :current="request()->routeIs('customers.*')" wire:navigate>
{{ __('layout.customers') }}
</flux:navbar.item>
@can('users.manage')
<flux:navbar.item :href="route('users.index')" :current="request()->routeIs('users.*')" wire:navigate>
{{ __('layout.users') }}
</flux:navbar.item>
@endcan
</flux:navbar>
<div class="flex flex-wrap items-center gap-3">
<flux:text size="sm">{{ __('layout.signed_in_as', ['name' => auth()->user()->name]) }}</flux:text>
@include('partials.theme-toggle')
<form method="POST" action="{{ route('logout') }}">
@csrf
<flux:button type="submit" variant="ghost" size="sm" icon="arrow-right-start-on-rectangle">
{{ __('layout.logout') }}
</flux:button>
</form>
</div>
</div>
</header>
@else
<div class="flex justify-end px-4 pt-3 sm:px-6">
@include('partials.theme-toggle')
</div>
@endauth
<main id="main-content" tabindex="-1" class="focus:outline-none">
{{ $slot }}
</main>
@livewireScripts
@fluxScripts
</body>
</html>