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]>
This commit is contained in:
@@ -44,6 +44,8 @@
|
||||
<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">
|
||||
@@ -53,6 +55,10 @@
|
||||
</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">
|
||||
|
||||
Reference in New Issue
Block a user