From b2e1cebbe1f2d4f018fea3bc472ae85456dc1d21 Mon Sep 17 00:00:00 2001 From: Bryan Stopp Date: Wed, 4 Sep 2024 10:00:20 -0400 Subject: [PATCH] fix extra space on fewer cards. (#268) --- blocks/property-listing/property-listing.js | 6 +++++- blocks/shared/property/cards.css | 2 +- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/blocks/property-listing/property-listing.js b/blocks/property-listing/property-listing.js index 11549b93..8ee4fde7 100644 --- a/blocks/property-listing/property-listing.js +++ b/blocks/property-listing/property-listing.js @@ -10,6 +10,10 @@ export default async function decorate(block) { // Find and process list type configurations. const config = readBlockConfig(block); const search = await Search.fromBlockConfig(config); + if (search.pageSize % 4 !== 0) { + search.pageSize -= (search.pageSize % 4); + } + search.franchiseeCode = getMetadata('office-id'); const searchUrl = `search?${search.asCregURLSearchParameters()}`; @@ -35,7 +39,7 @@ export default async function decorate(block) { block.innerHTML = ''; } - const list = div({ class: `property-list-cards rows-${Math.floor(search.pageSize / 8)}` }); + const list = div({ class: `property-list-cards rows-${Math.floor(search.pageSize / 4)}` }); block.append(list); propertySearch(search).then((results) => { renderCards(list, results.properties); diff --git a/blocks/shared/property/cards.css b/blocks/shared/property/cards.css index cca4a1f2..55f329c5 100644 --- a/blocks/shared/property/cards.css +++ b/blocks/shared/property/cards.css @@ -331,7 +331,7 @@ @media (min-width: 1200px) { .property-list-cards { display: grid; - grid-template: repeat(2, 1fr) / repeat(4, 1fr); + grid-template-columns: repeat(4, 1fr); gap: 20px; padding-bottom: 20px; }