Skip to content

Commit 2fb2ee7

Browse files
ChristianVierthalerChristian Vierthaler
andauthored
fix(ZMSKVR-719): overlapping textinput in zmscitizenview (#1713)
* fix(ZMSKVR-719): Anpassung Textfeldgröße bei kleinem Viewport * fix(ZMSKVR-719): removed style issue * fix(ZMSKVR-719): coderabbit suggestion, update on window resize * fix(ZMSKVR-719): outsourcing in new utils file * fix(ZMSKVR-719): add SSR safety check * fix(ZMSKVR-719): improved readability * fix(ZMSKVR-719): code style issue --------- Co-authored-by: Christian Vierthaler <[email protected]>
1 parent 978d48c commit 2fb2ee7

File tree

2 files changed

+34
-0
lines changed

2 files changed

+34
-0
lines changed

zmscitizenview/src/components/Appointment/CustomerInfo.vue

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -115,6 +115,7 @@
115115
:label="selectedProvider.scope.customTextfieldLabel ?? undefined"
116116
:required="selectedProvider.scope.customTextfieldRequired ?? undefined"
117117
:maxlength="100"
118+
:rows="textfieldRows"
118119
/>
119120
<muc-text-area
120121
v-if="
@@ -128,6 +129,7 @@
128129
:label="selectedProvider.scope.customTextfield2Label ?? undefined"
129130
:required="selectedProvider.scope.customTextfield2Required ?? undefined"
130131
:maxlength="100"
132+
:rows="textfieldRows"
131133
/>
132134
</form>
133135
<div class="m-button-group">
@@ -167,6 +169,7 @@ import { computed, inject, onBeforeUnmount, onMounted, ref, watch } from "vue";
167169
168170
import { GlobalState } from "@/types/GlobalState";
169171
import { CustomerDataProvider } from "@/types/ProvideInjectTypes";
172+
import { textfieldRows, updateWindowWidth } from "@/utils/textfieldRows";
170173
import { useReservationTimer } from "@/utils/useReservationTimer";
171174
172175
const props = defineProps<{
@@ -289,6 +292,18 @@ const errorDisplayTelephoneNumber = computed(
289292
errorMessageTelephoneNumber.value ?? maxLengthMessageTelephoneNumber.value
290293
);
291294
295+
onMounted(() => {
296+
if (typeof window !== "undefined") {
297+
window.addEventListener("resize", updateWindowWidth);
298+
}
299+
});
300+
301+
onBeforeUnmount(() => {
302+
if (typeof window !== "undefined") {
303+
window.removeEventListener("resize", updateWindowWidth);
304+
}
305+
});
306+
292307
const errorMessageCustomTextfield = computed(() => {
293308
if (!showErrorMessage.value) return undefined;
294309
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
import { computed, ref } from "vue";
2+
3+
const pivotWidth = 500;
4+
const smallScreenTextareaRows = 6;
5+
const bigScreenTextareaRows = 3;
6+
7+
const windowWidth = ref(typeof window !== "undefined" ? window.innerWidth : 0);
8+
9+
export const updateWindowWidth = () => {
10+
if (typeof window !== "undefined") {
11+
windowWidth.value = window.innerWidth;
12+
}
13+
};
14+
15+
export const textfieldRows = computed(() => {
16+
return windowWidth.value <= pivotWidth
17+
? smallScreenTextareaRows
18+
: bigScreenTextareaRows;
19+
});

0 commit comments

Comments
 (0)