AppTopBar.vue 4.4KB

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