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