StickyMenu.vue 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142
  1. <template>
  2. <div :class="stickyClass" v-if="!mdAndDown">
  3. <v-row class="outil-row">
  4. <v-col cols="12">
  5. <div class="container-square">
  6. <v-row
  7. v-for="square in squares"
  8. :key="square.id"
  9. :class="['square', square.bgColor]"
  10. @click="() => handleSquareClick(square)"
  11. >
  12. <NuxtLink :to="square.url" class="link">
  13. <div>
  14. <v-icon :class="square.iconClass" />
  15. <p class="text-square mt-2">{{ square.text }}</p>
  16. </div>
  17. </NuxtLink>
  18. </v-row>
  19. </div>
  20. </v-col>
  21. </v-row>
  22. </div>
  23. <div v-if="mdAndDown">
  24. <div class="sticky-menu">
  25. <v-btn color="primary">Bouton 1</v-btn>
  26. <v-btn color="secondary">Bouton 2</v-btn>
  27. </div>
  28. </div>
  29. </template>
  30. <script setup lang="ts">
  31. import { ref, defineProps } from "vue";
  32. import { useRouter } from "vue-router";
  33. import { useDisplay } from "vuetify";
  34. const { mdAndDown } = useDisplay();
  35. const router = useRouter();
  36. const props = defineProps({
  37. shouldShowStickyMenu: Boolean,
  38. squaresData: Array,
  39. });
  40. const stickyClass = ref("sticky-scroll");
  41. const squares = ref(props.squaresData);
  42. const telephoneNumber = "09 72 12 60 17";
  43. const handleSquareClick = (square) => {
  44. if (square.id === 2) {
  45. router.push({ path: square.url, query: { request: "demo" } });
  46. } else if (square.id === 4) {
  47. if (isMobileDevice()) {
  48. window.location.href = `tel:${telephoneNumber}`;
  49. } else {
  50. alert(`Notre numéro de téléphone : ${telephoneNumber}`);
  51. }
  52. } else {
  53. router.push({ path: square.url });
  54. }
  55. };
  56. const isMobileDevice = () => {
  57. return /Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(
  58. navigator.userAgent
  59. );
  60. };
  61. </script>
  62. <style scoped>
  63. .sticky-menu {
  64. position: fixed;
  65. bottom: 0;
  66. width: 100%;
  67. display: flex;
  68. justify-content: center;
  69. background-color: white;
  70. z-index: 100;
  71. }
  72. .square {
  73. transition: transform 0.3s ease-in-out;
  74. }
  75. .square:hover {
  76. transform: translateX(-10px);
  77. }
  78. .link {
  79. text-decoration: none;
  80. color: white;
  81. }
  82. .container-square {
  83. text-align: center !important;
  84. display: flex;
  85. flex-direction: column;
  86. color: white;
  87. font-weight: 500;
  88. font-size: 0.7rem;
  89. line-height: 15px;
  90. text-align: center;
  91. letter-spacing: 0.2em;
  92. text-transform: uppercase;
  93. }
  94. .red-square,
  95. .yellow-square,
  96. .blue-square,
  97. .darkblue-square,
  98. .green-square {
  99. position: relative;
  100. font-family: "Barlow";
  101. width: 7rem;
  102. padding: 1rem;
  103. cursor: pointer;
  104. }
  105. .yellow-square {
  106. background: rgb(250, 194, 10);
  107. color: #0e2d32;
  108. }
  109. .green-square {
  110. background: #9edbdd;
  111. }
  112. .red-square {
  113. background: #d8050b;
  114. }
  115. .blue-square {
  116. background: var(--Bleu-School-60, rgba(32, 147, 190));
  117. }
  118. .darkblue-square {
  119. background: #0e2d32;
  120. }
  121. .text-square {
  122. }
  123. </style>