123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204
  1. <script setup>
  2. import { Link } from '@inertiajs/inertia-vue3'
  3. defineEmits(['menu-toggle'])
  4. </script>
  5. <template>
  6. <div class="layout-topbar">
  7. <Link href="/" class="layout-topbar-logo">
  8. <img alt="Logo" src="/images/logo.svg" class="md:mr-3" />
  9. <span>Parkirin</span>
  10. </Link>
  11. <button class="p-link layout-menu-button layout-topbar-button" @click="$emit('menu-toggle', $event)">
  12. <i class="pi pi-bars"></i>
  13. </button>
  14. <button
  15. class="p-link layout-topbar-menu-button layout-topbar-button"
  16. v-styleclass="{
  17. selector: '@next',
  18. enterClass: 'hidden',
  19. enterActiveClass: 'scalein',
  20. leaveToClass: 'hidden',
  21. leaveActiveClass: 'fadeout',
  22. hideOnOutsideClick: true,
  23. }"
  24. >
  25. <i class="pi pi-ellipsis-v"></i>
  26. </button>
  27. <ul class="layout-topbar-menu hidden lg:flex origin-top">
  28. <li class="align-self-center">
  29. <span class="hidden lg:inline">{{ $page.props.auth.user.name }}</span>
  30. </li>
  31. <li>
  32. <Link :href="route('users.show', $page.props.auth.user.id)" class="p-link layout-topbar-button">
  33. <i class="pi pi-user"></i>
  34. <span>Profil Saya</span>
  35. </Link>
  36. </li>
  37. <li>
  38. <Link :href="route('logout')" as="button" method="post" class="p-link layout-topbar-button">
  39. <i class="pi pi-sign-out"></i>
  40. <span>Sign Out</span>
  41. </Link>
  42. </li>
  43. </ul>
  44. </div>
  45. </template>
  46. <style lang="scss" scoped>
  47. $transition: 0.2s;
  48. @mixin focused() {
  49. outline: 0 none;
  50. outline-offset: 0;
  51. transition: box-shadow $transition;
  52. box-shadow: var(--focus-ring);
  53. }
  54. .layout-topbar {
  55. position: fixed;
  56. height: 5rem;
  57. z-index: 997;
  58. left: 0;
  59. top: 0;
  60. width: 100%;
  61. padding: 0 2rem;
  62. background-color: var(--surface-card);
  63. transition: left $transition;
  64. display: flex;
  65. align-items: center;
  66. box-shadow: 0px 3px 5px rgba(0, 0, 0, 0.02), 0px 0px 2px rgba(0, 0, 0, 0.05), 0px 1px 4px rgba(0, 0, 0, 0.08);
  67. .layout-topbar-logo {
  68. display: flex;
  69. align-items: center;
  70. color: var(--surface-900);
  71. font-size: 1.5rem;
  72. font-weight: 500;
  73. width: 300px;
  74. border-radius: 12px;
  75. img {
  76. height: 2.5rem;
  77. margin-right: 0.5rem;
  78. }
  79. &:focus {
  80. @include focused();
  81. }
  82. }
  83. .layout-topbar-button {
  84. display: inline-flex;
  85. justify-content: center;
  86. align-items: center;
  87. position: relative;
  88. color: var(--text-color-secondary);
  89. border-radius: 50%;
  90. width: 3rem;
  91. height: 3rem;
  92. cursor: pointer;
  93. transition: background-color $transition;
  94. &:hover {
  95. color: var(--text-color);
  96. background-color: var(--surface-hover);
  97. }
  98. &:focus {
  99. @include focused();
  100. }
  101. i {
  102. font-size: 1.5rem;
  103. }
  104. span {
  105. font-size: 1rem;
  106. display: none;
  107. }
  108. }
  109. .layout-menu-button {
  110. margin-left: 2rem;
  111. }
  112. .layout-topbar-menu-button {
  113. display: none;
  114. i {
  115. font-size: 1.25rem;
  116. }
  117. }
  118. .layout-topbar-menu {
  119. margin: 0 0 0 auto;
  120. padding: 0;
  121. list-style: none;
  122. display: flex;
  123. .layout-topbar-button {
  124. margin-left: 1rem;
  125. }
  126. }
  127. }
  128. @media (max-width: 991px) {
  129. .layout-topbar {
  130. justify-content: space-between;
  131. .layout-topbar-logo {
  132. width: auto;
  133. order: 2;
  134. }
  135. .layout-menu-button {
  136. margin-left: 0;
  137. order: 1;
  138. }
  139. .layout-topbar-menu-button {
  140. display: inline-flex;
  141. margin-left: 0;
  142. order: 3;
  143. }
  144. .layout-topbar-menu {
  145. margin-left: 0;
  146. position: absolute;
  147. flex-direction: column;
  148. background-color: var(--surface-overlay);
  149. box-shadow: 0px 3px 5px rgba(0, 0, 0, 0.02), 0px 0px 2px rgba(0, 0, 0, 0.05), 0px 1px 4px rgba(0, 0, 0, 0.08);
  150. border-radius: 4px;
  151. padding: 1rem;
  152. right: 2rem;
  153. top: 5rem;
  154. min-width: 15rem;
  155. .layout-topbar-button {
  156. margin-left: 0;
  157. display: flex;
  158. width: 100%;
  159. height: auto;
  160. justify-content: flex-start;
  161. border-radius: 12px;
  162. padding: 1rem;
  163. i {
  164. font-size: 1rem;
  165. margin-right: 0.5rem;
  166. }
  167. span {
  168. font-weight: medium;
  169. display: block;
  170. }
  171. }
  172. }
  173. }
  174. }
  175. </style>