From 3145bcbebaff1329de732eb2b2a3e1e65c4affb0 Mon Sep 17 00:00:00 2001 From: Rob Rusher Date: Wed, 8 May 2024 13:31:27 -0600 Subject: [PATCH] fix filter for office name --- blocks/offices/offices.css | 3 ++- blocks/offices/offices.js | 4 +--- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/blocks/offices/offices.css b/blocks/offices/offices.css index 05298e41..692c5c21 100644 --- a/blocks/offices/offices.css +++ b/blocks/offices/offices.css @@ -133,6 +133,7 @@ display: flex; flex-direction: row; flex-wrap: wrap; + gap: 20px } .offices.block.agents .cards-list .cards-item, @@ -142,8 +143,8 @@ flex-direction: column; width: 16.66%; min-width: 200px; + max-width: 248px; flex-grow: 1; - padding: 10px; } .offices.block.agents .cards-list .cards-item .card-image { diff --git a/blocks/offices/offices.js b/blocks/offices/offices.js index 23fd6460..37403f5a 100644 --- a/blocks/offices/offices.js +++ b/blocks/offices/offices.js @@ -11,7 +11,6 @@ function buildOfficeCards(list, data) { const cardImage = document.createElement('div'); cardImage.className = 'card-image'; const image = createOptimizedPicture(item.image, item.location, true); - image.style = 'padding-bottom: 75%'; const type = document.createElement('p'); type.innerText = item.type; cardImage.append(image, type); @@ -43,7 +42,7 @@ function buildAgentCards(list, data) { const { pathname } = window.location; const parts = pathname.split('/'); const pageName = parts[parts.length - 1]; - const filteredData = data.filter((item) => item.office.toLowerCase() === pageName); + const filteredData = data.filter((item) => toClassName(item.office) === toClassName(pageName)); filteredData.forEach((item) => { const cardsItem = document.createElement('div'); cardsItem.className = 'cards-item'; @@ -53,7 +52,6 @@ function buildAgentCards(list, data) { const pic = document.createElement('picture'); const image = document.createElement('img'); pic.append(image); - // pic.style = 'padding-bottom: 75%'; image.src = tmpImage; image.loading = 'eager'; cardImage.append(pic);