From 1c5f7c5936ebec0737a3abc10ac3ae6c2fac1159 Mon Sep 17 00:00:00 2001 From: Gowtami Date: Thu, 12 Oct 2023 22:46:56 +0530 Subject: [PATCH 1/4] herobanner js and css updated code --- blocks/hero/hero.css | 10 ++++++---- blocks/hero/hero.js | 23 +++++++++++++++++++++++ 2 files changed, 29 insertions(+), 4 deletions(-) diff --git a/blocks/hero/hero.css b/blocks/hero/hero.css index cc5f4fa5..f448537b 100644 --- a/blocks/hero/hero.css +++ b/blocks/hero/hero.css @@ -15,14 +15,16 @@ main .hero { } main .hero h1 { - max-width: 1200px; - margin-left: auto; - margin-right: auto; + line-height: 1.2; + padding: 0; color: white; + font-size: 44px; + text-shadow: 0 0 6px rgba(0,0,0,.5); } main .hero picture { position: absolute; + height : 310px; z-index: -1; top: 0; left: 0; @@ -36,4 +38,4 @@ main .hero img { object-fit: cover; width: 100%; height: 100%; -} +} \ No newline at end of file diff --git a/blocks/hero/hero.js b/blocks/hero/hero.js index e69de29b..6dd7394b 100644 --- a/blocks/hero/hero.js +++ b/blocks/hero/hero.js @@ -0,0 +1,23 @@ +export default function decorate(block) { + const heroClass = document.getElementsByClassName("hero block"); + heroClass[0].children[0].setAttribute('class','outer'); + heroClass[0].children[0].children[0].setAttribute('class','vertical') + const heroDiv = heroClass[0].children[0].children[0]; + const pTags= heroDiv.getElementsByTagName('p'); + var innerElements=''; + for(var i=0;i/g,''); + innerElements += heroTitle.replace(/<\/p>/g,'
'); + }else if(i==2){ + const heroDescription = pTags[i].outerHTML.replace(//g,''); + innerElements += heroDescription.replace(/<\/p>/g,'
'); + }else { + const heroImage = pTags[i].outerHTML.replace(//g,''); + innerElements += heroImage.replace(/<\/p>/g,'
'); + } + } + heroDiv.innerHTML = '

'+innerElements+'

'; + } From fef65441fc16d07e32bd5f542ed96bd40c8d29b7 Mon Sep 17 00:00:00 2001 From: Pardeep Gera Date: Fri, 13 Oct 2023 10:50:27 +0530 Subject: [PATCH 2/4] resolved linting issues --- blocks/hero/hero.js | 40 ++++++++++++++++++++-------------------- 1 file changed, 20 insertions(+), 20 deletions(-) diff --git a/blocks/hero/hero.js b/blocks/hero/hero.js index 6dd7394b..d4a686a7 100644 --- a/blocks/hero/hero.js +++ b/blocks/hero/hero.js @@ -1,23 +1,23 @@ export default function decorate(block) { - const heroClass = document.getElementsByClassName("hero block"); - heroClass[0].children[0].setAttribute('class','outer'); - heroClass[0].children[0].children[0].setAttribute('class','vertical') - const heroDiv = heroClass[0].children[0].children[0]; - const pTags= heroDiv.getElementsByTagName('p'); - var innerElements=''; - for(var i=0;i/g,''); - innerElements += heroTitle.replace(/<\/p>/g,'
'); - }else if(i==2){ - const heroDescription = pTags[i].outerHTML.replace(//g,''); - innerElements += heroDescription.replace(/<\/p>/g,'
'); - }else { - const heroImage = pTags[i].outerHTML.replace(//g,''); - innerElements += heroImage.replace(/<\/p>/g,'
'); - } + const heroClass = document.getElementsByClassName('hero block'); + heroClass[0].children[0].setAttribute('class', 'outer'); + heroClass[0].children[0].children[0].setAttribute('class', 'vertical'); + const heroDiv = heroClass[0].children[0].children[0]; + const pTags = heroDiv.getElementsByTagName('p'); + let innerElements = ''; + for (let i = 0; i < pTags.length; i++) { + if (pTags[i].outerHTML.includes('class')) { + innerElements += pTags[i].innerHTML.replace('class=\"button\"', 'style=\"background-color:#000;\" class=\"hs-button\" target=\"_blank\"'); + } else if (i === 1) { + const heroTitle = pTags[i].outerHTML.replace(//g, ''); + innerElements += heroTitle.replace(/<\/p>/g, '
'); + } else if (i === 2) { + const heroDescription = pTags[i].outerHTML.replace(//g, ''); + innerElements += heroDescription.replace(/<\/p>/g, '
'); + } else { + const heroImage = pTags[i].outerHTML.replace(//g, ''); + innerElements += heroImage.replace(/<\/p>/g, '
'); } - heroDiv.innerHTML = '

'+innerElements+'

'; } + heroDiv.innerHTML = '

' + innerElements + '

'; +} From b8a6a52bf6dca4e4fef8471e2ab8e602adfe1375 Mon Sep 17 00:00:00 2001 From: Gowtami Date: Fri, 13 Oct 2023 15:14:28 +0530 Subject: [PATCH 3/4] fixed lint issues --- blocks/hero/hero.js | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/blocks/hero/hero.js b/blocks/hero/hero.js index d4a686a7..b9bcab3f 100644 --- a/blocks/hero/hero.js +++ b/blocks/hero/hero.js @@ -1,23 +1,23 @@ -export default function decorate(block) { +export default function decorate() { const heroClass = document.getElementsByClassName('hero block'); heroClass[0].children[0].setAttribute('class', 'outer'); heroClass[0].children[0].children[0].setAttribute('class', 'vertical'); const heroDiv = heroClass[0].children[0].children[0]; const pTags = heroDiv.getElementsByTagName('p'); let innerElements = ''; - for (let i = 0; i < pTags.length; i++) { + for (let i = 0; i < pTags.length; i += 1) { if (pTags[i].outerHTML.includes('class')) { - innerElements += pTags[i].innerHTML.replace('class=\"button\"', 'style=\"background-color:#000;\" class=\"hs-button\" target=\"_blank\"'); + innerElements += pTags[i].innerHTML.replace('class="button"', 'style="background-color:#000;" class="hs-button" target="_blank"'); } else if (i === 1) { - const heroTitle = pTags[i].outerHTML.replace(//g, ''); + const heroTitle = pTags[i].outerHTML.replace(//g, ''); innerElements += heroTitle.replace(/<\/p>/g, '
'); } else if (i === 2) { - const heroDescription = pTags[i].outerHTML.replace(//g, ''); + const heroDescription = pTags[i].outerHTML.replace(//g, ''); innerElements += heroDescription.replace(/<\/p>/g, '
'); } else { - const heroImage = pTags[i].outerHTML.replace(//g, ''); + const heroImage = pTags[i].outerHTML.replace(//g, ''); innerElements += heroImage.replace(/<\/p>/g, '
'); } } - heroDiv.innerHTML = '

' + innerElements + '

'; + heroDiv.innerHTML = `

${innerElements}

`; } From d9402cbb78dc375b8dbe286e89e99007dc800843 Mon Sep 17 00:00:00 2001 From: Gowtami Date: Fri, 13 Oct 2023 17:23:24 +0530 Subject: [PATCH 4/4] fixed lint issue on css --- blocks/hero/hero.css | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/blocks/hero/hero.css b/blocks/hero/hero.css index f448537b..e4129eb9 100644 --- a/blocks/hero/hero.css +++ b/blocks/hero/hero.css @@ -19,7 +19,7 @@ main .hero h1 { padding: 0; color: white; font-size: 44px; - text-shadow: 0 0 6px rgba(0,0,0,.5); + text-shadow: 0 0 6px rgba(0,0,0,50%); } main .hero picture {