diff --git a/src/app/website/signup/Signup.astro b/src/app/website/signup/Signup.astro index 4fa1f99..b559d76 100644 --- a/src/app/website/signup/Signup.astro +++ b/src/app/website/signup/Signup.astro @@ -124,7 +124,7 @@ const { signupDisabled, signupHash } = Astro.props; - + @@ -181,6 +181,7 @@ const { signupDisabled, signupHash } = Astro.props; function setupForm() { const form = document.getElementById('signup')! as HTMLFormElement; + const sendBtn = document.getElementById('send-btn')! as HTMLButtonElement; // reset form on site (re-)load form.reset(); @@ -229,9 +230,11 @@ const { signupDisabled, signupHash } = Astro.props; }); }; - form.addEventListener('submit', (e) => { + form.addEventListener('submit', async (e) => { e.preventDefault(); - sendSignup(); + sendBtn.classList.add('loading-overlay'); + await sendSignup(); + sendBtn.classList.remove('loading-overlay'); }); } diff --git a/src/styles/websiteLayout.css b/src/styles/websiteLayout.css index 793f48d..7924ef2 100644 --- a/src/styles/websiteLayout.css +++ b/src/styles/websiteLayout.css @@ -39,3 +39,37 @@ h5, h6 { @apply font-minecraft; } + +@layer utilities { + .btn.loading-overlay { + @apply btn-disabled relative; + + &::before, + &::after { + content: ''; + box-sizing: border-box; + width: 30px; + height: 30px; + border-radius: 50%; + border: 2px solid #fff; + position: absolute; + animation: animloader 2s linear infinite; + } + + &::after { + opacity: 0; + animation-delay: 1s; + } + } +} + +@keyframes animloader { + 0% { + transform: scale(0); + opacity: 1; + } + 100% { + transform: scale(1); + opacity: 0; + } +}