StickyMenu.vue 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122
  1. <template>
  2. <div :class="stickyClass">
  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. </template>
  24. <script setup lang="ts">
  25. import { ref, defineProps } from "vue";
  26. import { useRouter } from "vue-router";
  27. const router = useRouter();
  28. const props = defineProps({
  29. shouldShowStickyMenu: Boolean,
  30. squaresData: Array,
  31. });
  32. const stickyClass = ref("sticky-scroll");
  33. const squares = ref(props.squaresData);
  34. const telephoneNumber = "09 72 12 60 17";
  35. const handleSquareClick = (square) => {
  36. if (square.id === 2) {
  37. router.push({ path: square.url, query: { request: "demo" } });
  38. } else if (square.id === 4) {
  39. if (isMobileDevice()) {
  40. window.location.href = `tel:${telephoneNumber}`;
  41. } else {
  42. alert(`Notre numéro de téléphone : ${telephoneNumber}`);
  43. }
  44. } else {
  45. router.push({ path: square.url });
  46. }
  47. };
  48. const isMobileDevice = () => {
  49. return /Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(
  50. navigator.userAgent
  51. );
  52. };
  53. </script>
  54. <style scoped>
  55. .square {
  56. transition: transform 0.3s ease-in-out;
  57. }
  58. .square:hover {
  59. transform: translateX(-10px);
  60. }
  61. .link {
  62. text-decoration: none;
  63. color: white;
  64. }
  65. .container-square {
  66. display: flex;
  67. flex-direction: column;
  68. color: white;
  69. font-weight: 500;
  70. font-size: 0.7rem;
  71. line-height: 15px;
  72. text-align: center;
  73. letter-spacing: 0.2em;
  74. text-transform: uppercase;
  75. }
  76. .red-square,
  77. .yellow-square,
  78. .blue-square,
  79. .darkblue-square,
  80. .green-square {
  81. position: relative;
  82. font-family: "Barlow";
  83. width: 7rem;
  84. padding: 1rem;
  85. cursor: pointer;
  86. }
  87. .yellow-square {
  88. background: #f9d648;
  89. color: #0e2d32;
  90. }
  91. .green-square {
  92. background: #9edbdd;
  93. }
  94. .red-square {
  95. background: #d8050b;
  96. }
  97. .blue-square {
  98. background: var(--Bleu-School-60, rgba(32, 147, 190));
  99. }
  100. .darkblue-square {
  101. background: #0e2d32;
  102. }
  103. .text-square {
  104. }
  105. </style>