AppTopBar.vue 4.1KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202
  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. @mixin focused() {
  48. outline: 0 none;
  49. outline-offset: 0;
  50. transition: box-shadow 0.2s;
  51. box-shadow: var(--focus-ring);
  52. }
  53. .layout-topbar {
  54. position: fixed;
  55. height: 5rem;
  56. z-index: 997;
  57. left: 0;
  58. top: 0;
  59. width: 100%;
  60. padding: 0 2rem;
  61. background-color: var(--surface-card);
  62. transition: left 0.2s;
  63. display: flex;
  64. align-items: center;
  65. 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);
  66. .layout-topbar-logo {
  67. display: flex;
  68. align-items: center;
  69. color: var(--surface-900);
  70. font-size: 1.5rem;
  71. font-weight: 500;
  72. width: 300px;
  73. border-radius: 12px;
  74. img {
  75. height: 2.5rem;
  76. margin-right: 0.5rem;
  77. }
  78. &:focus {
  79. @include focused();
  80. }
  81. }
  82. .layout-topbar-button {
  83. display: inline-flex;
  84. justify-content: center;
  85. align-items: center;
  86. position: relative;
  87. color: var(--text-color-secondary);
  88. border-radius: 50%;
  89. width: 3rem;
  90. height: 3rem;
  91. cursor: pointer;
  92. transition: background-color 0.2s;
  93. &:hover {
  94. color: var(--text-color);
  95. background-color: var(--surface-hover);
  96. }
  97. &:focus {
  98. @include focused();
  99. }
  100. i {
  101. font-size: 1.5rem;
  102. }
  103. span {
  104. font-size: 1rem;
  105. display: none;
  106. }
  107. }
  108. .layout-menu-button {
  109. margin-left: 2rem;
  110. }
  111. .layout-topbar-menu-button {
  112. display: none;
  113. i {
  114. font-size: 1.25rem;
  115. }
  116. }
  117. .layout-topbar-menu {
  118. margin: 0 0 0 auto;
  119. padding: 0;
  120. list-style: none;
  121. display: flex;
  122. .layout-topbar-button {
  123. margin-left: 1rem;
  124. }
  125. }
  126. }
  127. @media (max-width: 991px) {
  128. .layout-topbar {
  129. justify-content: space-between;
  130. .layout-topbar-logo {
  131. width: auto;
  132. order: 2;
  133. }
  134. .layout-menu-button {
  135. margin-left: 0;
  136. order: 1;
  137. }
  138. .layout-topbar-menu-button {
  139. display: inline-flex;
  140. margin-left: 0;
  141. order: 3;
  142. }
  143. .layout-topbar-menu {
  144. margin-left: 0;
  145. position: absolute;
  146. flex-direction: column;
  147. background-color: var(--surface-overlay);
  148. 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);
  149. border-radius: 12px;
  150. padding: 1rem;
  151. right: 2rem;
  152. top: 5rem;
  153. min-width: 15rem;
  154. .layout-topbar-button {
  155. margin-left: 0;
  156. display: flex;
  157. width: 100%;
  158. height: auto;
  159. justify-content: flex-start;
  160. border-radius: 12px;
  161. padding: 1rem;
  162. i {
  163. font-size: 1rem;
  164. margin-right: 0.5rem;
  165. }
  166. span {
  167. font-weight: medium;
  168. display: block;
  169. }
  170. }
  171. }
  172. }
  173. }
  174. </style>