forked from adobe-rnd/aem-boilerplate-xwalk
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
8202caa
commit b0b643c
Showing
3 changed files
with
65 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,37 @@ | ||
import { createButton, createCarousle, getProps } from "../../scripts/scripts.js"; | ||
import { generateTabName } from "../tab-name/tab-name.js"; | ||
|
||
export default function decorate(block) { | ||
return generateTabName(block) | ||
const [parentTabName, parentTabId, child1TabName, child1TabId, child2TabName, child2TabId] = getProps(block); | ||
// const names = parentTabName.split(","); | ||
const ids = parentTabId.split(","); | ||
// const child1names = child1TabName.split(","); | ||
// const child1ids = child1TabId.split(","); | ||
// const child2names = child2TabName.split(","); | ||
// const child2ids = child2TabId.split(","); | ||
const copyblock = copyElements(block); | ||
block.innerHTML = ""; | ||
const child1 = generateTabName(createBlockElement([copyblock.children[2], copyblock.children[3], "", "carousel", "<", ">"])) | ||
const child2 = generateTabName(createBlockElement([copyblock.children[4], copyblock.children[5], "", "carousel", "<", ">"])) | ||
child1.dataset.id = ids[0]; | ||
child2.dataset.id = ids[1]; | ||
child1.classList.add("nested-tab-name-child") | ||
child2.classList.add("nested-tab-name-child", "dp-none") | ||
block.append(generateTabName(createBlockElement([copyblock.children[0], copyblock.children[1], "", "", "<", ">"]))); | ||
block.append(child1); | ||
block.append(child2); | ||
} | ||
|
||
function copyElements(el) { | ||
const div = document.createElement("div") | ||
div.innerHTML = el.innerHTML ? el.innerHTML : el; | ||
return div; | ||
|
||
} | ||
function createBlockElement(children) { | ||
const block = document.createElement("div"); | ||
children.forEach(function (child) { | ||
block.append(copyElements(child)); | ||
}) | ||
return block; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters