From 7a4e8cded2e4ec8f3ab715f555e763a31dfd6c13 Mon Sep 17 00:00:00 2001 From: Felipe Simoes Date: Mon, 5 Aug 2024 16:34:12 +0200 Subject: [PATCH] fixing nesting --- blocks/icon/icon.js | 1 + blocks/navigation/navigation.js | 25 +++++++------------------ 2 files changed, 8 insertions(+), 18 deletions(-) diff --git a/blocks/icon/icon.js b/blocks/icon/icon.js index 920c096a..53bfebbb 100644 --- a/blocks/icon/icon.js +++ b/blocks/icon/icon.js @@ -64,6 +64,7 @@ export default class Icon extends ComponentBase { // ! The initial and active icon names are separated with a double underline // ! The active icon is optional; + if (!newValue) return; const [initial, active] = newValue.split('__'); this.#initialIcon = initial; this.#activeIcon = active || null; diff --git a/blocks/navigation/navigation.js b/blocks/navigation/navigation.js index 7085b1fe..eb914524 100644 --- a/blocks/navigation/navigation.js +++ b/blocks/navigation/navigation.js @@ -98,27 +98,16 @@ export default class Navigation extends Column { } addIcon(elem) { - component.init({ - componentName: 'icon', - targets: [elem], - configByClasses: 'icon-chevron-right', - componentConfig: { - addToTargetMethod: 'append', - }, - }); + const icon = document.createElement('raqn-icon'); + icon.dataset.icon = 'chevron-right'; + elem.append(icon); } createAccordion(elem) { - component.init({ - componentName: 'accordion', - targets: [elem], - componentConfig: { - addToTargetMethod: 'append', - }, - nestedComponentsConfig: { - button: { active: false }, - }, - }); + const content = Array.from(elem.children); + const accordion = document.createElement('heliux-accordion'); + accordion.append(...content); + elem.append(accordion); } setupClasses(ul, isCompact, level = 1) {