navigation.blade.php 5.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110
  1. <?php
  2. use App\Livewire\Actions\Logout;
  3. use Livewire\Volt\Component;
  4. new class extends Component
  5. {
  6. /**
  7. * Log the current user out of the application.
  8. */
  9. public function logout(Logout $logout): void
  10. {
  11. $logout();
  12. $this->redirect('/', navigate: true);
  13. }
  14. }; ?>
  15. <nav x-data="{ open: false }" class="bg-white dark:bg-gray-800 border-b border-gray-100 dark:border-gray-700">
  16. <!-- Primary Navigation Menu -->
  17. <div class="max-w-7xl mx-auto px-4 sm:px-6 lg:px-8">
  18. <div class="flex justify-between h-16">
  19. <div class="flex">
  20. <!-- Logo -->
  21. <div class="shrink-0 flex items-center">
  22. <a href="{{ route('dashboard') }}" wire:navigate>
  23. <x-application-logo class="block h-9 w-auto fill-current text-gray-800 dark:text-gray-200" />
  24. </a>
  25. </div>
  26. <!-- Navigation Links -->
  27. <div class="hidden space-x-8 sm:-my-px sm:ms-10 sm:flex">
  28. <x-nav-link :href="route('dashboard')" :active="request()->routeIs('dashboard')" wire:navigate>
  29. {{ __('Dashboard') }}
  30. </x-nav-link>
  31. </div>
  32. </div>
  33. <!-- Settings Dropdown -->
  34. <div class="hidden sm:flex sm:items-center sm:ms-6">
  35. <x-dropdown align="right" width="48">
  36. <x-slot name="trigger">
  37. <button class="inline-flex items-center px-3 py-2 border border-transparent text-sm leading-4 font-medium rounded-md text-gray-500 dark:text-gray-400 bg-white dark:bg-gray-800 hover:text-gray-700 dark:hover:text-gray-300 focus:outline-none transition ease-in-out duration-150">
  38. <div x-data="{{ json_encode(['name' => auth()->user()->name]) }}" x-text="name" x-on:profile-updated.window="name = $event.detail.name"></div>
  39. <div class="ms-1">
  40. <svg class="fill-current h-4 w-4" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20">
  41. <path fill-rule="evenodd" d="M5.293 7.293a1 1 0 011.414 0L10 10.586l3.293-3.293a1 1 0 111.414 1.414l-4 4a1 1 0 01-1.414 0l-4-4a1 1 0 010-1.414z" clip-rule="evenodd" />
  42. </svg>
  43. </div>
  44. </button>
  45. </x-slot>
  46. <x-slot name="content">
  47. <x-dropdown-link :href="route('profile')" wire:navigate>
  48. {{ __('Profile') }}
  49. </x-dropdown-link>
  50. <!-- Authentication -->
  51. <button wire:click="logout" class="w-full text-start">
  52. <x-dropdown-link>
  53. {{ __('Log Out') }}
  54. </x-dropdown-link>
  55. </button>
  56. </x-slot>
  57. </x-dropdown>
  58. </div>
  59. <!-- Hamburger -->
  60. <div class="-me-2 flex items-center sm:hidden">
  61. <button @click="open = ! open" class="inline-flex items-center justify-center p-2 rounded-md text-gray-400 dark:text-gray-500 hover:text-gray-500 dark:hover:text-gray-400 hover:bg-gray-100 dark:hover:bg-gray-900 focus:outline-none focus:bg-gray-100 dark:focus:bg-gray-900 focus:text-gray-500 dark:focus:text-gray-400 transition duration-150 ease-in-out">
  62. <svg class="h-6 w-6" stroke="currentColor" fill="none" viewBox="0 0 24 24">
  63. <path :class="{'hidden': open, 'inline-flex': ! open }" class="inline-flex" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M4 6h16M4 12h16M4 18h16" />
  64. <path :class="{'hidden': ! open, 'inline-flex': open }" class="hidden" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M6 18L18 6M6 6l12 12" />
  65. </svg>
  66. </button>
  67. </div>
  68. </div>
  69. </div>
  70. <!-- Responsive Navigation Menu -->
  71. <div :class="{'block': open, 'hidden': ! open}" class="hidden sm:hidden">
  72. <div class="pt-2 pb-3 space-y-1">
  73. <x-responsive-nav-link :href="route('dashboard')" :active="request()->routeIs('dashboard')" wire:navigate>
  74. {{ __('Dashboard') }}
  75. </x-responsive-nav-link>
  76. </div>
  77. <!-- Responsive Settings Options -->
  78. <div class="pt-4 pb-1 border-t border-gray-200 dark:border-gray-600">
  79. <div class="px-4">
  80. <div class="font-medium text-base text-gray-800 dark:text-gray-200" x-data="{{ json_encode(['name' => auth()->user()->name]) }}" x-text="name" x-on:profile-updated.window="name = $event.detail.name"></div>
  81. <div class="font-medium text-sm text-gray-500">{{ auth()->user()->email }}</div>
  82. </div>
  83. <div class="mt-3 space-y-1">
  84. <x-responsive-nav-link :href="route('profile')" wire:navigate>
  85. {{ __('Profile') }}
  86. </x-responsive-nav-link>
  87. <!-- Authentication -->
  88. <button wire:click="logout" class="w-full text-start">
  89. <x-responsive-nav-link>
  90. {{ __('Log Out') }}
  91. </x-responsive-nav-link>
  92. </button>
  93. </div>
  94. </div>
  95. </div>
  96. </nav>