From 3a4949259c27a7524a9c8be7fc5eb9cdfb74ec74 Mon Sep 17 00:00:00 2001 From: danix Date: Wed, 1 Mar 2023 09:01:45 +0100 Subject: [PATCH] modified the contact form --- assets/js/contact.js | 11 ++++-- assets/sass/layout/_contact.scss | 6 +-- layouts/shortcodes/contact.html | 65 ++++++++++++++++++++++++-------- 3 files changed, 61 insertions(+), 21 deletions(-) diff --git a/assets/js/contact.js b/assets/js/contact.js index 020d0e7..2aa5dde 100644 --- a/assets/js/contact.js +++ b/assets/js/contact.js @@ -8,13 +8,15 @@ 'use strict'; const form = document.querySelector('.contact-form'); - const button = form.querySelector('.form-submit'); + const submit_button = form.querySelector('.form-submit'); + const reset_button = form.querySelector('.form-reset'); const action = form.getAttribute('data-protect'); const body = document.querySelector('body'); function activateForm() { form.setAttribute('action', action); - button.removeAttribute('disabled'); + submit_button.removeAttribute('disabled'); + reset_button.removeAttribute('disabled'); } // Display the hidden form. @@ -32,7 +34,10 @@ }); // Mark the form as submitted. - button.addEventListener('click', () => form.classList.add('js-submitted')); + submit_button.addEventListener('click', () => form.classList.add('js-submitted')); + + // Reset the form with the clear button + reset_button.addEventListener('click', () => form.reset()); // Display messages. if (location.search.substring(1) !== '') { diff --git a/assets/sass/layout/_contact.scss b/assets/sass/layout/_contact.scss index f224d4a..0834446 100644 --- a/assets/sass/layout/_contact.scss +++ b/assets/sass/layout/_contact.scss @@ -10,7 +10,7 @@ border-bottom: solid 1px _palette_light(border); overflow-x: hidden; @media screen and (prefers-color-scheme: dark) { - border-bottom: solid 1px _palette_dark(border); + border-bottom: solid 1px _palette_dark(fg-light); } > .inner { @@ -22,7 +22,7 @@ border-right: solid 1px _palette_light(border); width: 60%; @media screen and (prefers-color-scheme: dark) { - border-right: solid 1px _palette_dark(border); + border-right: solid 1px _palette_dark(fg-light); } } @@ -47,7 +47,7 @@ top: 0; width: calc(100vw + 3em); @media screen and (prefers-color-scheme: dark) { - border-top: solid 1px _palette_dark(border); + border-top: solid 1px _palette_dark(fg-light); } } } diff --git a/layouts/shortcodes/contact.html b/layouts/shortcodes/contact.html index 21e23f3..8430813 100644 --- a/layouts/shortcodes/contact.html +++ b/layouts/shortcodes/contact.html @@ -1,16 +1,51 @@ -

{{ i18n "js_required" }}

- - +
+
+
+ +

{{ i18n "js_required" }}

+ + + + + + +
+
+
+
+ +

Reach out to me

+

I'm here to help, if you need to talk to me feel free to reach out and tell me whatever you need help with, I'll be happy to find some time to discuss the matter with you!

+
+
+
+
+
+ + - -- 2.20.1