From 29c62c5d972a11311eb62b835dddc96609d965ac Mon Sep 17 00:00:00 2001 From: alexanderroese Date: Tue, 13 Aug 2024 11:40:15 +0200 Subject: [PATCH] auto change font size to small if text is too long --- snippets/shx-3d-render-input.liquid | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/snippets/shx-3d-render-input.liquid b/snippets/shx-3d-render-input.liquid index c996013..a324ab3 100644 --- a/snippets/shx-3d-render-input.liquid +++ b/snippets/shx-3d-render-input.liquid @@ -1005,21 +1005,24 @@ this.loadingSpinner.showErrorCharLottie("Hoppla, der von dir eingegebene Text ist zu lang. Bitte kürze ihn oder wende dich an uns für eine individuelle Lösung."); this.disableBuyButton(); - console.log("text too long, selectect font size", document.querySelector('#shx-fontSize').value); - + {%comment %} // if font size is not small, set it to small + // most users are not changing the font size, so we set it for them + // because they only want to generate the product and not to change the font size + // so with this we will keep the user flow and the user will not be confused + {% endcomment %} if(document.querySelector('#shx-fontSize').value !== 'Klein #small') { - alert("Here3 Text ist zu lang. Wir haben die Schriftgröße auf klein gesetzt. Bitte überprüfe deinen Text."); - document.querySelector('#shx-fontSize').value = 'Klein #small'; document.querySelector('#shx-fontSize').dispatchEvent(new Event('change')); + // show info text that the text is too long and we set the font size to small document.querySelector('#shx-info-text').style.display = 'block'; + // hide the text after 5 seconds setTimeout(() => { document.querySelector('#shx-info-text').style.display = 'none'; - }, 5000); + }, 10000); } }