From 20afa555677e7f09242556955e89c9e018b44e43 Mon Sep 17 00:00:00 2001 From: BrettS Date: Tue, 22 Jul 2025 09:36:12 +0200 Subject: [PATCH 1/3] Use provide and inject to pass information direct from parent to child component --- .../koala/source/src/components/BaseCarousel.vue | 8 ++++++++ .../koala/source/src/components/BatteryCard.vue | 16 ++++++++++------ .../source/src/components/BatteryInformation.vue | 10 ++++------ .../source/src/components/ChargePointCard.vue | 9 ++++----- .../src/components/ChargePointInformation.vue | 5 +---- .../koala/source/src/components/VehicleCard.vue | 9 ++++----- .../source/src/components/VehicleInformation.vue | 5 +---- 7 files changed, 32 insertions(+), 30 deletions(-) diff --git a/packages/modules/web_themes/koala/source/src/components/BaseCarousel.vue b/packages/modules/web_themes/koala/source/src/components/BaseCarousel.vue index 04ee7100e0..bd662b834f 100644 --- a/packages/modules/web_themes/koala/source/src/components/BaseCarousel.vue +++ b/packages/modules/web_themes/koala/source/src/components/BaseCarousel.vue @@ -41,6 +41,7 @@ import { nextTick, onMounted, onBeforeUnmount, + provide, } from 'vue'; import { useQuasar } from 'quasar'; @@ -113,6 +114,13 @@ onBeforeUnmount(() => { const effectiveCardWidth = ref(undefined); +// Function provided to child components +const setCardWidth = (width: number | undefined) => { + effectiveCardWidth.value = width ? width + 72 : undefined; // Add 72px to account for padding / margins / navigation buttons in carousel +}; + +provide('setCardWidth', setCardWidth); + // Computes how many cards can fit in the carousel based on carousel width and the card width const groupSize = computed(() => { return effectiveCardWidth.value diff --git a/packages/modules/web_themes/koala/source/src/components/BatteryCard.vue b/packages/modules/web_themes/koala/source/src/components/BatteryCard.vue index 16bdaaaded..dc287d4563 100644 --- a/packages/modules/web_themes/koala/source/src/components/BatteryCard.vue +++ b/packages/modules/web_themes/koala/source/src/components/BatteryCard.vue @@ -25,7 +25,10 @@ {{ power }} -
+
Laden mit Überschuss:
diff --git a/packages/modules/web_themes/koala/source/src/components/BatteryInformation.vue b/packages/modules/web_themes/koala/source/src/components/BatteryInformation.vue index 48aeaa6d2d..0924078c35 100644 --- a/packages/modules/web_themes/koala/source/src/components/BatteryInformation.vue +++ b/packages/modules/web_themes/koala/source/src/components/BatteryInformation.vue @@ -1,23 +1,21 @@