Skip to content

Commit

Permalink
teaser v2 updated with select and innerhtml
Browse files Browse the repository at this point in the history
  • Loading branch information
Sm1pleScr1pt committed Jul 3, 2024
1 parent 6227074 commit daf7446
Show file tree
Hide file tree
Showing 2 changed files with 38 additions and 2 deletions.
7 changes: 5 additions & 2 deletions blocks/teaserv2/teaserv2.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ export default function decorate(block) {
}

function renderTeaserHTMLFactory(props) {
const [mainHref, bgImage, frontImage, title, description, mobileDescription, button, buttonHref, bgColor, teaserv2Attr] = props;
const [mainHref, bgImage, frontImage, title, description, mobileDescription, button, buttonHref, bgColor, teaserv2Attr, textwithinnerhtml] = props;

const createElement = (tag, className, content) => {
const element = document.createElement(tag);
Expand Down Expand Up @@ -41,7 +41,10 @@ function renderTeaserHTMLFactory(props) {
newButtonTag = createElement("div", "button-container-text", button?.textContent.trim() || "");
}

bgImageDiv.append(frontImageDiv, titleDiv, descriptionDiv, newButtonTag);
const textwithDiv = document.createElement("div");
textwithDiv.innerHTML = textwithinnerhtml?.innerHTML || "";

bgImageDiv.append(frontImageDiv, titleDiv, descriptionDiv, newButtonTag, textwithDiv);

const teaserv2AttrGet = teaserv2Attr?.textContent?.trim() || "";
teaserv2Attr.closest(".teaserv2-wrapper").setAttribute("data-teaserv2-xf", teaserv2AttrGet);
Expand Down
33 changes: 33 additions & 0 deletions component-models.json
Original file line number Diff line number Diff line change
Expand Up @@ -1698,6 +1698,39 @@
"value": "",
"label": "teaserv2 Attribute",
"description": "Set TeaserV2 Attribute"
},
{
"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"
}
]
}
]
},
{
"component": "richtext",
"valueType": "string",
"name": "textwithinnerhtml",
"value": "",
"label": "Text With RTE"
}
]
},
Expand Down

0 comments on commit daf7446

Please sign in to comment.