- 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]>
20 lines
684 B
PHP
20 lines
684 B
PHP
{{--
|
|
Light/dark theme toggle. Flux stores the choice in localStorage
|
|
("flux.appearance") and @fluxAppearance applies it before the page paints.
|
|
The name stays "Tumma teema"; aria-pressed tells whether it is on.
|
|
--}}
|
|
<flux:button
|
|
x-data
|
|
x-on:click="$flux.dark = ! $flux.dark"
|
|
x-bind:aria-pressed="$flux.dark ? 'true' : 'false'"
|
|
aria-label="{{ __('layout.theme_toggle') }}"
|
|
:tooltip="__('layout.theme_toggle')"
|
|
variant="ghost"
|
|
size="sm"
|
|
square
|
|
data-theme-toggle
|
|
>
|
|
<flux:icon.moon variant="mini" class="dark:hidden" aria-hidden="true" />
|
|
<flux:icon.sun variant="mini" class="hidden dark:block" aria-hidden="true" />
|
|
</flux:button>
|