Новый компонент Spinner
This commit is contained in:
parent
a8164ec227
commit
801aab424f
1 changed files with 28 additions and 3 deletions
|
|
@ -625,6 +625,31 @@ import { SITE_URL } from '@constants';
|
|||
transform: none;
|
||||
}
|
||||
|
||||
.btn-submit.loading {
|
||||
position: relative;
|
||||
color: transparent !important;
|
||||
pointer-events: none;
|
||||
}
|
||||
|
||||
.btn-submit.loading::after {
|
||||
content: '';
|
||||
position: absolute;
|
||||
width: 20px;
|
||||
height: 20px;
|
||||
top: 50%;
|
||||
left: 50%;
|
||||
margin-left: -10px;
|
||||
margin-top: -10px;
|
||||
border: 2px solid #ffffff;
|
||||
border-radius: 50%;
|
||||
border-top-color: transparent;
|
||||
animation: spin 0.8s linear infinite;
|
||||
}
|
||||
|
||||
@keyframes spin {
|
||||
to { transform: rotate(360deg); }
|
||||
}
|
||||
|
||||
.btn-submit:active {
|
||||
transform: translateY(0);
|
||||
}
|
||||
|
|
@ -877,7 +902,7 @@ import { SITE_URL } from '@constants';
|
|||
// Отправка данных на сервер
|
||||
const submitBtn = form.querySelector('.btn-submit') as HTMLButtonElement;
|
||||
submitBtn.disabled = true;
|
||||
submitBtn.textContent = 'Регистрация...';
|
||||
submitBtn.classList.add('loading');
|
||||
|
||||
try {
|
||||
const response = await fetch('/api/auth/sign-up', {
|
||||
|
|
@ -914,12 +939,12 @@ if (result.success) {
|
|||
} else {
|
||||
showError(emailInput, result.error || 'Ошибка регистрации');
|
||||
submitBtn.disabled = false;
|
||||
submitBtn.textContent = 'Зарегистрироваться';
|
||||
submitBtn.classList.remove('loading');
|
||||
}
|
||||
} catch (err) {
|
||||
showError(emailInput, 'Ошибка соединения');
|
||||
submitBtn.disabled = false;
|
||||
submitBtn.textContent = 'Зарегистрироваться';
|
||||
submitBtn.classList.remove('loading');
|
||||
}
|
||||
});
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue