|
|
|
@ -65,6 +65,20 @@ function updateProductFilter(state) { |
|
|
|
grid.hidden = visibleCount === 0; |
|
|
|
empty.hidden = visibleCount > 0; |
|
|
|
} |
|
|
|
function animateProductCards(state) { |
|
|
|
const panel = document.querySelector(`[data-category-panel="${state.categoryId}"]`); |
|
|
|
if (!panel) return; |
|
|
|
const cards = [...panel.querySelectorAll(".s-product-card:not([hidden])")]; |
|
|
|
cards.forEach((card) => { |
|
|
|
card.classList.remove("is-entering"); |
|
|
|
card.style.removeProperty("--enter-delay"); |
|
|
|
}); |
|
|
|
void panel.offsetWidth; |
|
|
|
cards.forEach((card, index) => { |
|
|
|
card.style.setProperty("--enter-delay", `${index * 50}ms`); |
|
|
|
card.classList.add("is-entering"); |
|
|
|
}); |
|
|
|
} |
|
|
|
function updateBreadcrumb(state) { |
|
|
|
const name = getCategoryName(state.categoryId); |
|
|
|
const breadcrumb = document.querySelector("[data-breadcrumb-current]"); |
|
|
|
@ -75,6 +89,7 @@ function updateView(state) { |
|
|
|
updateSidebar(state); |
|
|
|
updatePanels(state); |
|
|
|
updateProductFilter(state); |
|
|
|
animateProductCards(state); |
|
|
|
updateBreadcrumb(state); |
|
|
|
} |
|
|
|
function bindEvents(state) { |
|
|
|
|