Menu.vue 5.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108
  1. <script setup>
  2. import { ref } from 'vue'
  3. const props = defineProps({
  4. isShowingMenu: Boolean,
  5. })
  6. /* Initialize stores. */
  7. import { useSystemStore } from '@/stores/system'
  8. /* Initialize System. */
  9. const System = useSystemStore()
  10. const emit = defineEmits(['toggleMenu'])
  11. const curTab = ref(null)
  12. const toggleMenu = () => {
  13. emit('toggleMenu')
  14. }
  15. /* Set default tab. */
  16. curTab.value = 'wallet'
  17. </script>
  18. <template>
  19. <main v-if="isShowingMenu" class="relative z-10" role="dialog" aria-modal="true">
  20. <!-- Background backdrop, show/hide based on slide-over state. -->
  21. <div class="fixed inset-0"></div>
  22. <div class="fixed inset-0 overflow-hidden bg-sky-900">
  23. <div class="absolute inset-0 overflow-hidden">
  24. <div class="pointer-events-none fixed inset-y-0 right-0 flex max-w-full pl-10 sm:pl-16">
  25. <!--
  26. Slide-over panel, show/hide based on slide-over state.
  27. Entering: "transform transition ease-in-out duration-500 sm:duration-700"
  28. From: "translate-x-full"
  29. To: "translate-x-0"
  30. Leaving: "transform transition ease-in-out duration-500 sm:duration-700"
  31. From: "translate-x-0"
  32. To: "translate-x-full"
  33. -->
  34. <div class="pointer-events-auto w-full max-w-md">
  35. <div class="flex h-full flex-col overflow-y-scroll bg-white shadow-xl">
  36. <div class="px-4 py-6 sm:px-6">
  37. <div class="flex items-start justify-between">
  38. <h2 id="slide-over-heading" class="text-2xl font-semibold leading-6 text-gray-900">
  39. Main Menu
  40. </h2>
  41. <div class="ml-3 flex h-7 items-center">
  42. <button @click="toggleMenu" type="button" class="rounded-md bg-white text-gray-400 hover:text-gray-500 focus:ring-2 focus:ring-indigo-500">
  43. <span class="sr-only">Close panel</span>
  44. <svg class="h-10 w-10" fill="none" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor" aria-hidden="true">
  45. <path stroke-linecap="round" stroke-linejoin="round" d="M6 18L18 6M6 6l12 12" />
  46. </svg>
  47. </button>
  48. </div>
  49. </div>
  50. </div>
  51. <!-- Main -->
  52. <div>
  53. <div class="pb-1 sm:pb-6">
  54. <div>
  55. <section>
  56. <div class="block">
  57. <div class="border-b border-gray-200">
  58. <nav class="-mb-px flex" aria-label="Tabs">
  59. <button @click="curTab = 'wallet'" aria-current="page" class="w-1/3 border-b-2 py-4 px-1 text-center text-sm font-medium" :class="[{ 'border-indigo-500 text-indigo-600': curTab === 'wallet', 'border-transparent text-gray-500 hover:border-gray-300 hover:text-gray-700': curTab !== 'wallet' }]">
  60. Wallet
  61. </button>
  62. <button @click="curTab = 'settings'" aria-current="page" class="w-1/3 border-b-2 py-4 px-1 text-center text-sm font-medium" :class="[{ 'border-indigo-500 text-indigo-600': curTab === 'settings', 'border-transparent text-gray-500 hover:border-gray-300 hover:text-gray-700': curTab !== 'settings' }]">
  63. Settings
  64. </button>
  65. <button @click="curTab = 'help'" aria-current="page" class="w-1/3 border-b-2 py-4 px-1 text-center text-sm font-medium" :class="[{ 'border-indigo-500 text-indigo-600': curTab === 'help', 'border-transparent text-gray-500 hover:border-gray-300 hover:text-gray-700': curTab !== 'help' }]">
  66. Help
  67. </button>
  68. </nav>
  69. </div>
  70. </div>
  71. </section>
  72. <div class="mt-6 px-4 sm:mt-8 sm:flex sm:items-end sm:px-6">
  73. <MenuSettings v-if="curTab == 'settings'" class="w-full" />
  74. <MenuWallet v-if="curTab == 'wallet'" class="w-full" />
  75. <MenuHelp v-if="curTab == 'help'" class="w-full" />
  76. </div>
  77. </div>
  78. </div>
  79. </div>
  80. </div>
  81. </div>
  82. </div>
  83. </div>
  84. </div>
  85. </main>
  86. </template>