Files
Toiminnanohjaus/resources/views/components/nav-group.blade.php
T
petriandClaude Opus 5.5 6936d0950b Keep the header dark and give the light theme a grey content background
The header and its menu popovers always use the dark theme colours, the
light theme body is zinc-100 and Kanban columns zinc-200 so they still
stand out. The theme toggle icon follows the page theme through a new
page-dark variant, and TallStackUI hint and selection group description
texts are one shade darker to keep 4.5:1 contrast on the grey background.

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

60 lines
2.6 KiB
PHP

@props(['group'])
{{--
A main menu group: a disclosure button that opens a panel of links (WAI-ARIA disclosure navigation, not role="menu").
Escape and a click outside close it, and so does moving focus out of the group. The current section is
marked with an underline and hidden text, not colour alone, and the current link has aria-current="page".
--}}
<div
class="relative"
x-data="{ open: false }"
x-on:nav-group-opened.window="if ($event.detail !== '{{ $group['key'] }}') open = false"
x-on:keydown.escape="if (open) { open = false; $refs.trigger.focus() }"
x-on:click.outside="open = false"
x-on:focusout="if (open && ! $el.contains($event.relatedTarget)) open = false"
>
<button
type="button"
x-ref="trigger"
x-on:click="open = ! open; if (open) $dispatch('nav-group-opened', '{{ $group['key'] }}')"
x-bind:aria-expanded="open.toString()"
aria-expanded="false"
aria-controls="nav-group-{{ $group['key'] }}"
@class([
'flex items-center gap-1 rounded-md px-3 py-2 text-sm font-medium focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-blue-400',
'text-white underline decoration-2 underline-offset-8' => $group['current'],
'text-zinc-300 hover:bg-zinc-700 hover:text-white' => ! $group['current'],
])
>
{{ $group['label'] }}
@if ($group['current'])
<span class="sr-only">{{ __('layout.current_section') }}</span>
@endif
<x-icon name="chevron-down" class="size-4 transition-transform" x-bind:class="{ 'rotate-180': open }" aria-hidden="true" />
</button>
<ul
id="nav-group-{{ $group['key'] }}"
x-show="open"
x-cloak
class="z-40 mt-1 min-w-56 rounded-md border border-zinc-600 bg-zinc-800 p-1 shadow-lg sm:absolute sm:start-0"
>
@foreach ($group['items'] as $item)
<li>
<a
href="{{ route($item['route']) }}"
wire:navigate
@if ($item['current']) aria-current="page" @endif
@class([
'block rounded-md px-3 py-2 text-sm font-medium focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-blue-400',
'bg-zinc-700 text-white underline decoration-2 underline-offset-4' => $item['current'],
'text-zinc-200 hover:bg-zinc-700 hover:text-white' => ! $item['current'],
])
>
{{ $item['label'] }}
</a>
</li>
@endforeach
</ul>
</div>