TopBar.vue 4.5KB

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