|
| 1 | +<header class="flex flex-col gap-4 sm:flex-row sm:justify-between sm:items-center"> |
| 2 | + <div> |
| 3 | + <h1 class="text-2xl font-bold tracking-tight text-gray-950 dark:text-white sm:text-3xl">{{ $title ?? 'Page Title' }} - {{ config('app.name') }}</h1> |
| 4 | + </div> |
| 5 | + |
| 6 | + <div class="flex items-center shrink-0 gap-4"> |
| 7 | + <div |
| 8 | + x-data="{ theme: null }" |
| 9 | + x-init=" |
| 10 | + theme = localStorage.getItem('theme') || 'system' |
| 11 | + $watch('theme', () => { |
| 12 | + localStorage.setItem('theme', theme) |
| 13 | + const effectiveTheme = theme === 'system' |
| 14 | + ? (window.matchMedia('(prefers-color-scheme: dark)').matches ? 'dark' : 'light') |
| 15 | + : theme |
| 16 | + if (effectiveTheme === 'dark') { |
| 17 | + document.documentElement.classList.add('dark') |
| 18 | + } else { |
| 19 | + document.documentElement.classList.remove('dark') |
| 20 | + } |
| 21 | + $dispatch('theme-changed', theme) |
| 22 | + }) |
| 23 | + " |
| 24 | + class="flex items-center gap-1 p-1 rounded-lg bg-gray-100 dark:bg-gray-800" |
| 25 | + > |
| 26 | + <button |
| 27 | + type="button" |
| 28 | + x-on:click="theme = 'light'" |
| 29 | + x-bind:class="{ 'bg-white dark:bg-gray-900 shadow-sm': theme === 'light' }" |
| 30 | + class="p-2 rounded-md transition-all" |
| 31 | + aria-label="Light mode" |
| 32 | + > |
| 33 | + <x-tabler-sun class="size-4" /> |
| 34 | + </button> |
| 35 | + |
| 36 | + <button |
| 37 | + type="button" |
| 38 | + x-on:click="theme = 'dark'" |
| 39 | + x-bind:class="{ 'bg-white dark:bg-gray-900 shadow-sm': theme === 'dark' }" |
| 40 | + class="p-2 rounded-md transition-all" |
| 41 | + aria-label="Dark mode" |
| 42 | + > |
| 43 | + <x-tabler-moon class="size-4" /> |
| 44 | + </button> |
| 45 | + |
| 46 | + <button |
| 47 | + type="button" |
| 48 | + x-on:click="theme = 'system'" |
| 49 | + x-bind:class="{ 'bg-white dark:bg-gray-900 shadow-sm': theme === 'system' }" |
| 50 | + class="p-2 rounded-md transition-all" |
| 51 | + aria-label="System theme" |
| 52 | + > |
| 53 | + <x-tabler-device-desktop class="size-4" /> |
| 54 | + </button> |
| 55 | + </div> |
| 56 | + |
| 57 | + @auth |
| 58 | + <x-filament::button |
| 59 | + href="{{ url('/admin') }}" |
| 60 | + icon="tabler-layout-dashboard" |
| 61 | + iconButton="true" |
| 62 | + tag="a" |
| 63 | + size="lg" |
| 64 | + > |
| 65 | + {{ __('general.admin') }} |
| 66 | + </x-filament::button> |
| 67 | + @else |
| 68 | + <x-filament::button |
| 69 | + href="{{ url('/login') }}" |
| 70 | + icon="tabler-login" |
| 71 | + tag="a" |
| 72 | + size="lg" |
| 73 | + > |
| 74 | + {{ __('auth.sign_in') }} |
| 75 | + </x-filament::button> |
| 76 | + @endauth |
| 77 | + </div> |
| 78 | +</header> |
0 commit comments