Skip to content

Commit

Permalink
refactored code
Browse files Browse the repository at this point in the history
  • Loading branch information
kailasnadh790 committed Dec 1, 2023
1 parent 59ad3b7 commit ec30578
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 19 deletions.
18 changes: 8 additions & 10 deletions cigaradvisor/blocks/imagecta/imagecta.css
Original file line number Diff line number Diff line change
@@ -1,11 +1,9 @@
@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;
}
.home-tall-banner > a img{
display: block;
position: relative;
max-width: 100%;
max-height: 100%;
width: auto;
height: auto;
border: 1px solid #000;
}
14 changes: 5 additions & 9 deletions cigaradvisor/blocks/imagecta/imagecta.js
Original file line number Diff line number Diff line change
@@ -1,12 +1,8 @@
import {
createOptimizedPicture, readBlockConfig,
} from '../../scripts/aem.js';

export default async function decorate(block) {
const configs = readBlockConfig(block);
block.textContent = '';
const children = [];
const anchor = document.createElement('a');
anchor.append(createOptimizedPicture(configs.image));
anchor.setAttribute('href', configs.link);
block.append(anchor);
anchor.append(block.querySelector('picture'));
anchor.setAttribute('href', block.querySelector('a').getAttribute('href'));
children.push(anchor);
block.replaceChildren(...children);
}

0 comments on commit ec30578

Please sign in to comment.