generated from adobe/aem-boilerplate
-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Agent Address block added * Review Comments incorporated --------- Co-authored-by: piyushjindal <[email protected]>
- Loading branch information
1 parent
9153bac
commit b5466ba
Showing
2 changed files
with
57 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
.agent-address.block { | ||
padding: 2rem; | ||
background-color: var(--tertiary-color); | ||
} | ||
|
||
.agent-address.block .address { | ||
margin-bottom: 2rem; | ||
} | ||
|
||
.agent-address.block .address>p { | ||
margin-bottom: 0; | ||
font-size: var(--body-font-size-xs); | ||
} | ||
|
||
.agent-address.block a { | ||
border: 1px solid var(--primary-color); | ||
color: var(--primary-color); | ||
font-weight: var(--font-weight-bold); | ||
letter-spacing: var(--letter-spacing-m); | ||
text-transform: uppercase; | ||
padding: 0.5rem 1rem; | ||
text-decoration: none; | ||
font-size: var(--body-font-size-s); | ||
} | ||
|
||
.agent-address.block a:hover { | ||
color: var(--primary-light); | ||
background-color: var(--primary-color); | ||
} | ||
|
||
@media (min-width: 600px) { | ||
.agent-address.block { | ||
display: none; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
import { getMetadata } from '../../scripts/aem.js'; | ||
import { | ||
a, div, p, | ||
} from '../../scripts/dom-helpers.js'; | ||
|
||
export default function decorate(block) { | ||
const streetAddress = getMetadata('streetaddress'); | ||
const addressLocality = getMetadata('addresslocality'); | ||
const addressRegion = getMetadata('addressregion'); | ||
const postalCode = getMetadata('postalcode'); | ||
|
||
const textDiv = div({ class: 'address' }, | ||
p('Berkshire Hathaway HomeServices'), | ||
p('Commonwealth Real Estate'), | ||
p(streetAddress), | ||
p(`${addressLocality}, ${addressRegion} ${postalCode}`), | ||
); | ||
const text = `${streetAddress}, ${addressLocality}, ${addressRegion} ${postalCode}`; | ||
|
||
const anchor = a({ href: `https://maps.google.com/maps?q=${text}`, target: '_blank' }, 'Directions'); | ||
block.replaceChildren(textDiv, anchor); | ||
} |