Новые правки компоентов
This commit is contained in:
parent
9122756a58
commit
1838fd302d
14 changed files with 88 additions and 79 deletions
|
|
@ -167,5 +167,37 @@ const formatDate = (date: string) => {
|
|||
};
|
||||
|
||||
setupAnimations();
|
||||
document.addEventListener('astro:page-load', setupAnimations);
|
||||
setupFilter();
|
||||
|
||||
function setupFilter() {
|
||||
const buttons = document.querySelectorAll('.category-btn');
|
||||
const cards = document.querySelectorAll('.blog-card-wrapper');
|
||||
|
||||
buttons.forEach((btn) => {
|
||||
btn.addEventListener('click', (e) => {
|
||||
e.preventDefault();
|
||||
const category = btn.getAttribute('data-category');
|
||||
|
||||
buttons.forEach(b => b.classList.remove('active'));
|
||||
btn.classList.add('active');
|
||||
|
||||
cards.forEach((card) => {
|
||||
const cardCategory = card.getAttribute('data-category');
|
||||
const el = card as HTMLElement;
|
||||
if (category === 'Все' || cardCategory === category) {
|
||||
el.style.display = '';
|
||||
el.style.opacity = '0';
|
||||
el.style.transform = 'translateY(20px)';
|
||||
requestAnimationFrame(() => {
|
||||
el.style.transition = 'opacity 0.4s ease, transform 0.4s ease';
|
||||
el.style.opacity = '1';
|
||||
el.style.transform = 'translateY(0)';
|
||||
});
|
||||
} else {
|
||||
el.style.display = 'none';
|
||||
}
|
||||
});
|
||||
});
|
||||
});
|
||||
}
|
||||
</script>
|
||||
|
|
@ -168,5 +168,4 @@ const formatDate = (date: string) => {
|
|||
};
|
||||
|
||||
setupAnimations();
|
||||
document.addEventListener('astro:page-load', setupAnimations);
|
||||
</script>
|
||||
|
|
@ -183,8 +183,4 @@ const formatDate = (date: string) => {
|
|||
|
||||
setupAnimations();
|
||||
setupFilter();
|
||||
document.addEventListener('astro:page-load', () => {
|
||||
setupAnimations();
|
||||
setupFilter();
|
||||
});
|
||||
</script>
|
||||
|
|
@ -148,6 +148,38 @@ const formatDate = (date: string) => {
|
|||
});
|
||||
};
|
||||
|
||||
const setupFilter = () => {
|
||||
const buttons = document.querySelectorAll('.category-btn');
|
||||
const cards = document.querySelectorAll('.blog-card-wrapper');
|
||||
|
||||
buttons.forEach((btn) => {
|
||||
btn.addEventListener('click', (e) => {
|
||||
e.preventDefault();
|
||||
const category = btn.getAttribute('data-category');
|
||||
|
||||
buttons.forEach(b => b.classList.remove('active'));
|
||||
btn.classList.add('active');
|
||||
|
||||
cards.forEach((card) => {
|
||||
const cardCategory = card.getAttribute('data-category');
|
||||
const el = card as HTMLElement;
|
||||
if (category === 'Все' || cardCategory === category) {
|
||||
el.style.display = '';
|
||||
el.style.opacity = '0';
|
||||
el.style.transform = 'translateY(20px)';
|
||||
requestAnimationFrame(() => {
|
||||
el.style.transition = 'opacity 0.4s ease, transform 0.4s ease';
|
||||
el.style.opacity = '1';
|
||||
el.style.transform = 'translateY(0)';
|
||||
});
|
||||
} else {
|
||||
el.style.display = 'none';
|
||||
}
|
||||
});
|
||||
});
|
||||
});
|
||||
};
|
||||
|
||||
setupAnimations();
|
||||
document.addEventListener('astro:page-load', setupAnimations);
|
||||
setupFilter();
|
||||
</script>
|
||||
|
|
@ -344,10 +344,4 @@ const isAuthorized = false; // Измените на true, чтобы увиде
|
|||
// Инициализация
|
||||
setupAnimations();
|
||||
setupForm();
|
||||
|
||||
// Для поддержки Astro transitions
|
||||
document.addEventListener('astro:page-load', () => {
|
||||
setupAnimations();
|
||||
setupForm();
|
||||
});
|
||||
</script>
|
||||
|
|
|
|||
|
|
@ -181,8 +181,4 @@ const categories = getCategories();
|
|||
};
|
||||
|
||||
setupFilter();
|
||||
|
||||
document.addEventListener('astro:page-load', () => {
|
||||
setupFilter();
|
||||
});
|
||||
</script>
|
||||
|
|
|
|||
|
|
@ -195,9 +195,4 @@ import ReviewsList from '@components/reviews/ReviewsList.astro';
|
|||
|
||||
// Запуск
|
||||
setupAnimations();
|
||||
|
||||
// Для поддержки View Transitions в Astro
|
||||
document.addEventListener('astro:page-load', () => {
|
||||
setupAnimations();
|
||||
});
|
||||
</script>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue