|
|
@@ -1,61 +1,87 @@
|
|
|
<template>
|
|
|
- <div :class="stickyClass" v-if="!mdAndDown">
|
|
|
- <v-row class="outil-row">
|
|
|
- <v-col cols="12">
|
|
|
- <div class="container-square">
|
|
|
- <v-row
|
|
|
- v-for="square in squares"
|
|
|
- :key="square.id"
|
|
|
- :class="['square', square.bgColor]"
|
|
|
- @click="() => handleSquareClick(square)"
|
|
|
- >
|
|
|
- <NuxtLink :to="square.url" class="link">
|
|
|
- <div>
|
|
|
- <v-icon :class="square.iconClass" />
|
|
|
- <p class="text-square mt-2">{{ square.text }}</p>
|
|
|
- </div>
|
|
|
- </NuxtLink>
|
|
|
- </v-row>
|
|
|
- </div>
|
|
|
- </v-col>
|
|
|
- </v-row>
|
|
|
- </div>
|
|
|
+ <div class="sticky-menu">
|
|
|
+ <div class="container-square" v-if="lgAndUp">
|
|
|
+ <v-row
|
|
|
+ v-for="(action, index) in actionsOrDefault"
|
|
|
+ :key="index"
|
|
|
+ :class="['square', action.bgColor]"
|
|
|
+ @click="() => onActionClick(action)"
|
|
|
+ >
|
|
|
+ <NuxtLink :to="action.url" class="link">
|
|
|
+ <div>
|
|
|
+ <v-icon :class="action.iconClass" />
|
|
|
+ <p class="text-square mt-2">{{ action.text }}</p>
|
|
|
+ </div>
|
|
|
+ </NuxtLink>
|
|
|
+ </v-row>
|
|
|
+ </div>
|
|
|
|
|
|
- <div v-if="mdAndDown">
|
|
|
- <div class="sticky-menu">
|
|
|
- <v-btn color="primary">Bouton 1</v-btn>
|
|
|
- <v-btn color="secondary">Bouton 2</v-btn>
|
|
|
+ <div class="band" v-else-if="!layoutStore.isFooterVisible">
|
|
|
+ <v-btn color="#9edbdd">
|
|
|
+ Nous contacter
|
|
|
+ </v-btn>
|
|
|
+ <v-btn color="#0e2d32" style="color: white;">
|
|
|
+ Nous appeler
|
|
|
+ </v-btn>
|
|
|
</div>
|
|
|
</div>
|
|
|
</template>
|
|
|
|
|
|
<script setup lang="ts">
|
|
|
-import { ref, defineProps } from "vue";
|
|
|
+import { defineProps, ComputedRef } from "vue";
|
|
|
import { useRouter } from "vue-router";
|
|
|
import { useDisplay } from "vuetify";
|
|
|
+import { useLayoutStore } from "~/stores/layoutStore";
|
|
|
+import { StickyMenuActionType } from "~/types/enum/layout";
|
|
|
+import { StickyMenuAction } from "~/types/interface";
|
|
|
|
|
|
-const { mdAndDown } = useDisplay();
|
|
|
+const { mdAndDown, lgAndUp } = useDisplay();
|
|
|
const router = useRouter();
|
|
|
+const layoutStore = useLayoutStore()
|
|
|
+
|
|
|
+const telephoneNumber = "09 72 12 60 17";
|
|
|
+
|
|
|
+const defaultActions: Array<StickyMenuAction> = [
|
|
|
+ {
|
|
|
+ type: StickyMenuActionType.FOLLOW_LINK,
|
|
|
+ bgColor: "green-square",
|
|
|
+ iconClass: "fa-regular fa-comments icon",
|
|
|
+ text: "Nous contacter",
|
|
|
+ url: "/nous-contacter",
|
|
|
+ },
|
|
|
+ {
|
|
|
+ type: StickyMenuActionType.CALL_US,
|
|
|
+ bgColor: "darkblue-square",
|
|
|
+ iconClass: "fa-solid fa-phone icon",
|
|
|
+ text: "Nous Appeler",
|
|
|
+ },
|
|
|
+];
|
|
|
+
|
|
|
const props = defineProps({
|
|
|
- shouldShowStickyMenu: Boolean,
|
|
|
- squaresData: Array,
|
|
|
-});
|
|
|
+ actions: {
|
|
|
+ type: Array<StickyMenuAction>,
|
|
|
+ required: false,
|
|
|
+ default: []
|
|
|
+ }
|
|
|
+})
|
|
|
|
|
|
-const stickyClass = ref("sticky-scroll");
|
|
|
+const actionsOrDefault: ComputedRef<Array<StickyMenuAction>> = computed(() => {
|
|
|
+ return props.actions.length > 0 ? props.actions : defaultActions
|
|
|
+})
|
|
|
|
|
|
-const squares = ref(props.squaresData);
|
|
|
-const telephoneNumber = "09 72 12 60 17";
|
|
|
-const handleSquareClick = (square) => {
|
|
|
- if (square.id === 2) {
|
|
|
- router.push({ path: square.url, query: { request: "demo" } });
|
|
|
- } else if (square.id === 4) {
|
|
|
+const onActionClick = (action: StickyMenuAction) => {
|
|
|
+ if (action.type === StickyMenuActionType.ASK_FOR_A_DEMO) {
|
|
|
+ router.push({ path: action.url, query: { request: "demo" } });
|
|
|
+ } else if (action.type === StickyMenuActionType.CALL_US) {
|
|
|
if (isMobileDevice()) {
|
|
|
window.location.href = `tel:${telephoneNumber}`;
|
|
|
} else {
|
|
|
alert(`Notre numéro de téléphone : ${telephoneNumber}`);
|
|
|
}
|
|
|
+ } else if (action.url) {
|
|
|
+ router.push({ path: action.url });
|
|
|
} else {
|
|
|
- router.push({ path: square.url });
|
|
|
+ throw Error('Unrecognized action')
|
|
|
}
|
|
|
};
|
|
|
|
|
|
@@ -66,18 +92,7 @@ const isMobileDevice = () => {
|
|
|
};
|
|
|
</script>
|
|
|
|
|
|
-<style scoped>
|
|
|
-
|
|
|
-
|
|
|
-.sticky-menu {
|
|
|
- position: fixed;
|
|
|
- bottom: 0;
|
|
|
- width: 100%;
|
|
|
- display: flex;
|
|
|
- justify-content: center;
|
|
|
- background-color: white;
|
|
|
- z-index: 100;
|
|
|
-}
|
|
|
+<style scoped lang="scss">
|
|
|
.square {
|
|
|
transition: transform 0.3s ease-in-out;
|
|
|
}
|
|
|
@@ -139,4 +154,31 @@ const isMobileDevice = () => {
|
|
|
|
|
|
.text-square {
|
|
|
}
|
|
|
+
|
|
|
+@media (min-width: 1280px) {
|
|
|
+ .sticky-menu {
|
|
|
+ position: sticky;
|
|
|
+ //right: 0;
|
|
|
+ top: 50%;
|
|
|
+ transform: translateY(-50%);
|
|
|
+ z-index: 1;
|
|
|
+ float: right;
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
+// Menu format ruban (pour affichage petits écrans)
|
|
|
+.sticky-menu .band {
|
|
|
+ position: fixed;
|
|
|
+ height: 46px;
|
|
|
+ bottom: 0;
|
|
|
+ width: 100%;
|
|
|
+ display: flex;
|
|
|
+ justify-content: center;
|
|
|
+ background-color: white;
|
|
|
+ z-index: 100;
|
|
|
+
|
|
|
+ .v-btn {
|
|
|
+ margin: 4px 6px;
|
|
|
+ }
|
|
|
+}
|
|
|
</style>
|