Skip to content

Commit

Permalink
#461424 #461425 - Code cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
infloent committed Apr 22, 2024
1 parent 1a8d90a commit 32cb4ac
Show file tree
Hide file tree
Showing 5 changed files with 25 additions and 22 deletions.
29 changes: 13 additions & 16 deletions blocks/accordion/accordion.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,22 +3,19 @@ import ComponentBase from '../../scripts/component-base.js';
export default class Accordion extends ComponentBase {
dependencies = ['icon'];

// extendNestedConfig() {
// return [
// ...super.extendNestedConfig(),
// {
// button: {
// componentName: 'button',
// // active: false,
// loaderConfig: {
// targetsSelectorsPrefix: ':not(.accordion-control) >',
// },
// },
// },
// ];
// }

// nestedComponentsConfig = {};
extendNestedConfig() {
return [
...super.extendNestedConfig(),
{
button: {
componentName: 'button',
loaderConfig: {
targetsSelectorsPrefix: ':scope > :is(:nth-child(even)) >',
},
},
},
];
}

ready() {
this.setAttribute('role', 'navigation');
Expand Down
12 changes: 10 additions & 2 deletions blocks/button/button.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,16 @@ export default class Button extends ComponentBase {
targetsSelectors: ':is(p,div):has(> a:only-child)',
selectorTest: (el) => el.childNodes.length === 1,
};

nestedComponentsConfig = {};

nestedComponentsConfig = {
columns: {
componentName: 'columns',
active: false,
loaderConfig: {
targetsAsContainers: false,
},
},
};

extendConfig() {
return [
Expand Down
3 changes: 1 addition & 2 deletions blocks/column/column.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import ComponentBase from '../../scripts/component-base.js';

// ! Solution 1 to remove mixins
export default class ColumnN extends ComponentBase {
export default class Column extends ComponentBase {
static observedAttributes = ['position', 'size', 'justify'];

connected() {
Expand Down
1 change: 0 additions & 1 deletion blocks/columns/columns.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import { collectAttributes } from '../../scripts/libs.js';

// ! Solution 2 to remove mixins
export default class Columns {
static observedAttributes = ['position', 'size', 'justify'];

Expand Down
2 changes: 1 addition & 1 deletion scripts/component-loader.js
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ export default class ComponentLoader {
);

Object.keys(currentAttributes).forEach((key) => {
componentElem.setAttribute(key, currentAttributes[key]);
componentElem.setAttribute(key, currentAttributes[key].trim());
});

componentElem.nestedComponentsConfig = deepMerge(
Expand Down

0 comments on commit 32cb4ac

Please sign in to comment.