Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Agent Communities Changes #266

Merged
merged 4 commits into from
Aug 13, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 20 additions & 2 deletions blocks/agent-communities/agent-communities.css
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
@import url('./design-1.css');

.agent-communities.block {
height: 1000px;
min-height: 1000px;
}

.agent-communities.block .cards-list {
Expand Down Expand Up @@ -36,6 +38,16 @@
background: linear-gradient(transparent, transparent, rgba(0 0 0 / 50%));
}

.agent-communities.block .cards-list .cards-item-body h4:hover {
background: unset;
}

.agent-communities.block .cards-list .cards-item-body h4::before {
font-size: var(--heading-font-size-m);
font-weight: var(--font-weight-bold);
content: 'Explore ';
}

.agent-communities.block .cards-list .cards-item:first-of-type h4 {
color: var(--primary-color);
background: unset;
Expand All @@ -52,7 +64,6 @@
width: 100%;
height: fit-content;
object-fit: cover;
filter: brightness(0.8);
margin-bottom: 10px;
background-position: center 70%;
background-size: cover;
Expand All @@ -67,12 +78,19 @@
padding: .5rem .75rem;
text-decoration: none;
font-size: var(--body-font-size-xs);
font-weight: var(--font-weight-bold);
}

.agent-communities.block .hero-item-explore:hover {
color: var(--primary-light);
background-color: var(--primary-color);
}

.agent-communities.block .hero-item-heading {
text-transform: uppercase;
font-size: var(--body-font-size-s);
letter-spacing: 3.2px;
font-weight: var(--font-weight-bold);
}

.agent-communities.block .hero-item-bio {
Expand Down
26 changes: 15 additions & 11 deletions blocks/agent-communities/agent-communities.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,7 @@ export default async function decorate(block) {
block.appendChild(getLoader('agent-communities'));

window.setTimeout(async () => {
// const url = `/commonwealth-real-estate-ma312${window.location.pathname}`;
const url = '/commonwealth-real-estate-ma312/east-greenwich/barry-alofsin/cid-473521';
const url = `/commonwealth-real-estate-ma312${window.location.pathname}`;
const bhhsCode = 'bhhs-ma312';

const finalUrl = new URL('https://api.liveby.com/v1/pages');
Expand Down Expand Up @@ -54,17 +53,20 @@ export default async function decorate(block) {

if (data2.length) {
modifiedData.push(...data2.map((item) => {
const regex = /\/communities\/\w+$/;
const regex = /\/communities/;
const match = item.url.match(regex);
const link = match ? match[0] : '';

return {
name: item.name.toUpperCase(),
exploreName: `explore ${item.name}`,
link,
banner: item.banner_16x9,
};
}));
if (link) {
return {
name: item.name.toUpperCase(),
exploreName: `${item.name}`,
link,
banner: item.banner_16x9,
};
}
return null;
}).filter((item) => item !== undefined && item !== null));
}

const cardsList = div({ class: 'cards-list' });
Expand Down Expand Up @@ -96,7 +98,9 @@ export default async function decorate(block) {
cardBody.appendChild(paragraphElement);
});

block.appendChild(cardsList);
if (cardsList.hasChildNodes()) {
block.appendChild(cardsList);
}
} catch (error) {
// eslint-disable-next-line no-console
console.error('Error fetching data', error);
Expand Down
34 changes: 34 additions & 0 deletions blocks/agent-communities/design-1.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
.design-1 .agent-communities.block .cards-list .cards-item-body h4 {
font-family: var(--font-family-secondary);
font-size: 2rem;
text-transform: none;
padding-top: 3rem;
}

.design-1 .agent-communities.block .cards-list .cards-item-body h4::before {
font-size: 1rem;
line-height: var(--line-height-m);
letter-spacing: var(--letter-spacing-l);
display: block;
text-align: center;
margin-bottom: 0.5rem;
}

/*
Theme: Black & White
*/
.design-1.black-white .agent-communities.block .hero-item-explore {
color: var(--black);
border: solid 1px var(--black);
}

.design-1.black-white .agent-communities.block .hero-item-explore:hover {
color: var(--white);
background-color: var(--black);
}

.design-1.black-white .agent-communities.block .cards-list .cards-item:first-of-type h4 {
color: var(--black);
padding-left: 0.5rem;
padding-right: 0.5rem;
}
Loading