Skip to content

Commit

Permalink
fix filter for office name
Browse files Browse the repository at this point in the history
  • Loading branch information
rrusher committed May 8, 2024
1 parent ffd225c commit 3145bcb
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 4 deletions.
3 changes: 2 additions & 1 deletion blocks/offices/offices.css
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,7 @@
display: flex;
flex-direction: row;
flex-wrap: wrap;
gap: 20px
}

.offices.block.agents .cards-list .cards-item,
Expand All @@ -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 {
Expand Down
4 changes: 1 addition & 3 deletions blocks/offices/offices.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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';
Expand All @@ -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);
Expand Down

0 comments on commit 3145bcb

Please sign in to comment.