Skip to content

Commit

Permalink
image-cta
Browse files Browse the repository at this point in the history
  • Loading branch information
kailasnadh790 committed Nov 30, 2023
1 parent e9b6776 commit 11ec35e
Show file tree
Hide file tree
Showing 2 changed files with 38 additions and 0 deletions.
11 changes: 11 additions & 0 deletions cigaradvisor/blocks/imagecta/imagecta.css
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;
}
}
27 changes: 27 additions & 0 deletions cigaradvisor/blocks/imagecta/imagecta.js
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;

Check failure on line 4 in cigaradvisor/blocks/imagecta/imagecta.js

View workflow job for this annotation

GitHub Actions / build

Unexpected var, use let or const instead
[...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

View workflow job for this annotation

GitHub Actions / build

Strings must use singlequote

Check failure on line 10 in cigaradvisor/blocks/imagecta/imagecta.js

View workflow job for this annotation

GitHub Actions / build

Strings must use singlequote
link = col.textContent;
}
});
anchor.setAttribute("href", link);

Check failure on line 14 in cigaradvisor/blocks/imagecta/imagecta.js

View workflow job for this annotation

GitHub Actions / build

Strings must use singlequote

const children = block.children;

Check failure on line 16 in cigaradvisor/blocks/imagecta/imagecta.js

View workflow job for this annotation

GitHub Actions / build

Use object destructuring

// Loop through the children and remove those that are not anchor tags
for (let i = children.length - 1; i >= 0; i--) {

Check failure on line 19 in cigaradvisor/blocks/imagecta/imagecta.js

View workflow job for this annotation

GitHub Actions / build

Unary operator '--' used
if (children[i].tagName !== 'A') {
console.log(children[i].tagName);

Check warning on line 21 in cigaradvisor/blocks/imagecta/imagecta.js

View workflow job for this annotation

GitHub Actions / build

Unexpected console statement
block.removeChild(children[i]);
}
}
});
block.append(anchor);
}

Check failure on line 27 in cigaradvisor/blocks/imagecta/imagecta.js

View workflow job for this annotation

GitHub Actions / build

Newline required at end of file but not found

0 comments on commit 11ec35e

Please sign in to comment.