generated from adobe/aem-boilerplate
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
URL for testing: - https://feature-cta-image--famous-smoke-cigaradvisor--kailasnadh790.hlx.page/cigaradvisor/drafts/Kailas/image-cta
- Loading branch information
1 parent
e9b6776
commit 11ec35e
Showing
2 changed files
with
38 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,11 @@ | ||
@media (min-width: 60em) { | ||
.home-tall-banner > a { | ||
display: block!important; | ||
width: 100%!important; | ||
height: 100%!important; | ||
border: 1px solid #000!important; | ||
background-size: cover; | ||
background-position: 50% 50%; | ||
background-repeat: no-repeat; | ||
} | ||
} |
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,27 @@ | ||
export default function decorate(block) { | ||
const anchor = document.createElement('a'); | ||
[...block.children].forEach((row) => { | ||
var link; | ||
[...row.children].forEach((col) => { | ||
const pic = col.querySelector('picture'); | ||
if (pic) { | ||
anchor.append(pic); | ||
} | ||
if (col.textContent.toLowerCase() !== "image" && col.textContent.toLowerCase() !== "link") { | ||
Check failure on line 10 in cigaradvisor/blocks/imagecta/imagecta.js GitHub Actions / build
|
||
link = col.textContent; | ||
} | ||
}); | ||
anchor.setAttribute("href", link); | ||
|
||
const children = block.children; | ||
|
||
// Loop through the children and remove those that are not anchor tags | ||
for (let i = children.length - 1; i >= 0; i--) { | ||
if (children[i].tagName !== 'A') { | ||
console.log(children[i].tagName); | ||
block.removeChild(children[i]); | ||
} | ||
} | ||
}); | ||
block.append(anchor); | ||
} | ||