Skip to content

Commit

Permalink
Merge pull request #137 from WWWPiramalFinanceCOM/feature/homepage-bu…
Browse files Browse the repository at this point in the history
…gfixes

Feature/homepage bugfixes
  • Loading branch information
VaibhavSasulkar authored Jul 24, 2024
2 parents 864daa5 + d3e21d6 commit 3780b82
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 42 deletions.
4 changes: 2 additions & 2 deletions blocks/tab-container/tab-container.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import { generateDetailedTeaserDOM } from '../detailed-teaser/detailed-teaser.js';
import { generateTeaserDOM } from '../teaser/teaser.js';
import generateTeaserV2DOM from '../teaserv2/teaserv2.js';
import { renderTeaserHTMLFactory } from '../teaserv2/teaserv2.js';

const carouselContainerMapping = {}
carouselContainerMapping["detailed-teaser"] = generateDetailedTeaserDOM;
carouselContainerMapping["teaserv2"] = generateTeaserV2DOM;
carouselContainerMapping["teaserv2"] = renderTeaserHTMLFactory;

export default function decorate(block) {
const tabid = block.children[0].innerText.trim();
Expand Down
10 changes: 5 additions & 5 deletions blocks/teaserv2/teaserv2.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,12 @@ export default function decorate(block) {
loanProductsAnalytics(block);
}

function renderTeaserHTMLFactory(props) {
export function renderTeaserHTMLFactory(props) {

const isDesktop = window.matchMedia('(min-width: 900px)');
const isMobile = window.matchMedia('(max-width: 767px)');

const [mainHref, bgImage, frontImage, title, description, mobileDescription, button, buttonHref, bgColor, teaserv2Attr, textwithinnerhtml, mobileImg] = props;
let [mainHref, bgImage, frontImage, title, description, mobileDescription, button, buttonHref, bgColor, teaserv2Attr, textwithinnerhtml, mobileImg] = props;

const createElement = (tag, className, content) => {
const element = document.createElement(tag);
Expand All @@ -31,9 +31,9 @@ function renderTeaserHTMLFactory(props) {
const bgBannerColor = bgColor?.textContent.trim()?.src || "";
const bgImageDiv = createElement("div", "bg-image");

if(isDesktop){
if (isDesktop) {
if (bgImageSrc) bgImageDiv.style.backgroundImage = `url(${bgImageSrc})`;
}else if(isMobile){
} else if (isMobile) {
if (mobileSrc) bgImageDiv.style.backgroundImage = `url(${mobileSrc})`;
}

Expand Down Expand Up @@ -62,7 +62,7 @@ function renderTeaserHTMLFactory(props) {
bgImageDiv.append(frontImageDiv, titleDiv, descriptionDiv, newButtonTag, textwithDiv);

const teaserv2AttrGet = teaserv2Attr?.textContent?.trim() || "";
teaserv2Attr.closest(".teaserv2-wrapper").setAttribute("data-teaserv2-xf", teaserv2AttrGet);
teaserv2Attr.closest(".teaserv2-wrapper")?.setAttribute("data-teaserv2-xf", teaserv2AttrGet);

if (container.tagName === "A") {
container.append(bgImageDiv);
Expand Down
35 changes: 0 additions & 35 deletions component-models.json
Original file line number Diff line number Diff line change
Expand Up @@ -1868,41 +1868,6 @@
"label": "Background Image",
"description": "Background Image"
},
{
"component": "multiselect",
"name": "classes",
"label": "Style",
"valueType": "string",
"required": true,
"options": [
{
"name": "Theme",
"children": [
{
"name": "Light",
"value": "light"
},
{
"name": "Light",
"value": "light"
},
{
"name": "Dark",
"value": "dark"
}
]
},
{
"name": "Type",
"children": [
{
"name": "teaserv2",
"value": "teaserv2"
}
]
}
]
},
{
"component": "reference",
"valueType": "string",
Expand Down
3 changes: 3 additions & 0 deletions styles/company-details/company-details.css
Original file line number Diff line number Diff line change
Expand Up @@ -358,4 +358,7 @@
transform: translateY(100%);
max-height: 312px;
}
/* .section.company-details-wrapper.about-us-company-details .tab-link-wrapper .tab-link.block>div:first-child {
display: block;
} */
}

0 comments on commit 3780b82

Please sign in to comment.