NavBar.vue 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. <template>
  2. <nav class="relative w-full h-20 flex items-end animate__animated animate__fadeInUp animate__faster">
  3. <div class="w-full rounded-t-xl bg-stone-800 h-14"></div>
  4. <div
  5. class="top-0 left-0 absolute w-full h-full grid grid-cols-3 grid-rows-1 items-end"
  6. >
  7. <div
  8. v-for="(item, idx) in items"
  9. :key="idx"
  10. class="h-full flex justify-center items-end text-center"
  11. >
  12. <div
  13. @click="selectedIdx = idx"
  14. class="flex flex-col items-center justify-center bg-stone-800 px-4 cursor-pointer duration-300"
  15. :class="{
  16. 'h-20 rounded-t-full': idx === selectedIdx,
  17. 'h-14': idx !== selectedIdx,
  18. }"
  19. >
  20. <Icon :name="item.icon" class="w-10 h-10 duration-300" />
  21. <p :class="selectedIdx === idx ? 'opacity-100 mt-1 text-sm' : 'opacity-0 text-[0px] mt-0'" class="duration-300" v-text="item.name" />
  22. </div>
  23. </div>
  24. </div>
  25. </nav>
  26. </template>
  27. <script setup lang="ts">
  28. const items = ref([
  29. {
  30. name: "Новости",
  31. icon: "hugeicons:news",
  32. },
  33. {
  34. name: "Расписание",
  35. icon: "mdi:timetable",
  36. },
  37. {
  38. name: "Профиль",
  39. icon: "ph:student-bold",
  40. },
  41. ]);
  42. const selectedIdx = ref(0);
  43. </script>