Price.vue 5.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108
  1. <script setup>
  2. import { ref } from 'vue'
  3. const props = defineProps({
  4. isShowingPrice: Boolean,
  5. })
  6. /* Initialize stores. */
  7. import { useSystemStore } from '@/stores/system'
  8. /* Initialize System. */
  9. const System = useSystemStore()
  10. const emit = defineEmits(['togglePrice'])
  11. const curTab = ref(null)
  12. const togglePrice = () => {
  13. emit('togglePrice')
  14. }
  15. /* Set default tab. */
  16. curTab.value = 'live'
  17. </script>
  18. <template>
  19. <main v-if="isShowingPrice" 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-rose-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. Da Price Guru
  40. </h2>
  41. <div class="ml-3 flex h-7 items-center">
  42. <button @click="togglePrice" 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 = 'live'" 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 === 'live', 'border-transparent text-gray-500 hover:border-gray-300 hover:text-gray-700': curTab !== 'live' }]">
  60. LIVE
  61. </button>
  62. <button @click="curTab = 'past'" 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 === 'past', 'border-transparent text-gray-500 hover:border-gray-300 hover:text-gray-700': curTab !== 'past' }]">
  63. Past
  64. </button>
  65. <button @click="curTab = 'future'" 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 === 'future', 'border-transparent text-gray-500 hover:border-gray-300 hover:text-gray-700': curTab !== 'future' }]">
  66. Future
  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. <PriceLive v-if="curTab == 'live'" class="w-full" />
  74. <PricePast v-if="curTab == 'past'" class="w-full" />
  75. <PriceFuture v-if="curTab == 'future'" 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>