feat(frontend): add dynamic animations to login and admin panel

This commit is contained in:
Zuev
2026-02-20 00:48:03 +03:00
parent e9c08b4c75
commit 86a29f6419
9 changed files with 228 additions and 37 deletions

View File

@@ -12,6 +12,24 @@
const btnLoader = btnSubmit.querySelector('.btn-loader');
const togglePassword = document.getElementById('toggle-password');
// Ripple effect
btnSubmit.addEventListener('click', function(e) {
const rect = this.getBoundingClientRect();
const x = e.clientX - rect.left;
const y = e.clientY - rect.top;
const ripple = document.createElement('span');
ripple.classList.add('ripple');
ripple.style.left = `${x}px`;
ripple.style.top = `${y}px`;
this.appendChild(ripple);
setTimeout(() => {
ripple.remove();
}, 600);
});
togglePassword.addEventListener('click', () => {
const isPassword = passwordInput.type === 'password';
passwordInput.type = isPassword ? 'text' : 'password';
@@ -27,8 +45,14 @@
}
function setFieldError(input, errorEl, message) {
input.closest('.form-group').classList.add('has-error');
const group = input.closest('.form-group');
group.classList.add('has-error');
errorEl.textContent = message;
// Shake animation
group.classList.remove('shake');
void group.offsetWidth; // trigger reflow
group.classList.add('shake');
}
function showAlert(message, type) {