From fb6f6758623503af1566b551ef30630cb09d94b7 Mon Sep 17 00:00:00 2001 From: Kseninia Mikhaylova Date: Wed, 5 Jun 2024 14:54:43 +0300 Subject: [PATCH] add calc component file --- app.vue | 50 ++++--------------------------------- assets/main.scss | 2 +- components/calculator.vue | 5 ++++ components/modal.vue | 52 +++++++++++++++++++++++++++++++++++++++ 4 files changed, 63 insertions(+), 46 deletions(-) create mode 100644 components/calculator.vue create mode 100644 components/modal.vue diff --git a/app.vue b/app.vue index c823568..f9dd4e5 100644 --- a/app.vue +++ b/app.vue @@ -60,42 +60,10 @@ const delivery = (pagesData.value as ApiPagesType[]).find(el => el.slug == 'deli const { data: footerData } = await useFetch(`${apiBase}/footer/?ordering=small_text`) -const isModalOpen = ref(false) +const isModalOpen = useState('modal_open', () => false) const toggleModal = () => { - modal_phone.value = '' isModalOpen.value = !isModalOpen.value } -const modal_phone = ref() -const model_form = reactive({ - disabled: true, - errors: [], -}) - -const validateInput = (evt: KeyboardEvent) => { - const valid_symbols = /[a-zA-Z0-9\+(\\)\ @\.]/ - if (!valid_symbols.test(evt.key)) { - evt.preventDefault() - return - } -} -const validate = () => { - const phone_regexp = /\(?\+[0-9]{1,3}\)? ?-?[0-9]{1,3} ?-?[0-9]{3,5} ?-?[0-9]{4}( ?-?[0-9]{3})? ?(\w{1,10}\s?\d{1,6})?/ - const email_regex = /^[\w-\.]+@([\w-]+\.)+[\w-]{2,4}$/ - - if (modal_phone.value.length < 3) { - model_form.disabled = true - return - } - if (phone_regexp.test(modal_phone.value) || email_regex.test(modal_phone.value)) { - model_form.disabled = false - return - } -} -const submit = (e: any) => { - console.log(e) - modal_phone.value = '' - isModalOpen.value = false -} - + diff --git a/assets/main.scss b/assets/main.scss index 2754d17..34b29d3 100644 --- a/assets/main.scss +++ b/assets/main.scss @@ -24,7 +24,7 @@ body { @apply col-span-8 flex justify-between; } -a[href^="/#"]:not([class*="btn"]) { +a[href^="#"] { @apply underline decoration-dotted underline-offset-4 decoration-neutral-500; } diff --git a/components/calculator.vue b/components/calculator.vue new file mode 100644 index 0000000..de83d41 --- /dev/null +++ b/components/calculator.vue @@ -0,0 +1,5 @@ + \ No newline at end of file diff --git a/components/modal.vue b/components/modal.vue new file mode 100644 index 0000000..5ccc2a7 --- /dev/null +++ b/components/modal.vue @@ -0,0 +1,52 @@ + + \ No newline at end of file