StickyMenu.vue 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108
  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.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">{{ 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. .link {
  56. text-decoration: none;
  57. color: white;
  58. }
  59. .container-square {
  60. display: flex;
  61. flex-direction: column;
  62. color: white;
  63. font-weight: 500;
  64. font-size: 0.7rem;
  65. line-height: 15px;
  66. text-align: center;
  67. letter-spacing: 0.2em;
  68. text-transform: uppercase;
  69. }
  70. .red-square,
  71. .yellow-square,
  72. .blue-square,
  73. .darkblue-square {
  74. position: relative;
  75. font-family: "Barlow";
  76. width: 10rem;
  77. padding: 1rem;
  78. }
  79. .yellow-square {
  80. background: #f9d648;
  81. color: #0e2d32;
  82. }
  83. .red-square {
  84. background: #d8050b;
  85. }
  86. .blue-square {
  87. background: rgb(125, 194, 198);
  88. }
  89. .darkblue-square {
  90. background: #0e2d32;
  91. }
  92. .text-square {
  93. margin: 0.5rem 2rem;
  94. }
  95. </style>