generated from adobe/aem-boilerplate
-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #20 from hlxsites/remove-mixin
#474566 - remove mixin
- Loading branch information
Showing
10 changed files
with
15 additions
and
200 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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,23 +1,22 @@ | ||
import { collectAttributes } from '../../scripts/libs.js'; | ||
import ComponentBase from '../../scripts/component-base.js'; | ||
import ComponentMixin from '../../scripts/component-mixin.js'; | ||
|
||
// TODO the block for this component should not have content, the values should come only form class attribute as for any other component | ||
// as for any other block. should replace the this.parentElement | ||
export default class SectionMetadata extends ComponentBase { | ||
async ready() { | ||
const classes = [...this.querySelectorAll(':scope > div > div:first-child')] | ||
.map((keyCell) => `${keyCell.textContent.trim()}-${keyCell.nextElementSibling.textContent.trim()}`); | ||
|
||
const { currentAttributes } = collectAttributes('section-metadata', classes, await ComponentMixin.getMixins(), this.knownAttributes, this); | ||
const classes = [...this.querySelectorAll(':scope > div > div:first-child')].map( | ||
(keyCell) => `${keyCell.textContent.trim()}-${keyCell.nextElementSibling.textContent.trim()}`, | ||
); | ||
|
||
const { currentAttributes } = collectAttributes('section-metadata', classes, this.knownAttributes, this); | ||
const section = this.parentElement; | ||
Object.keys(currentAttributes).forEach((key) => { | ||
if(key === 'class') { | ||
if (key === 'class') { | ||
section.setAttribute(key, currentAttributes[key]); | ||
} else { | ||
section.setAttribute(`data-${key}`, currentAttributes[key]); | ||
} | ||
}); | ||
await ComponentMixin.startAll(section); | ||
} | ||
} |
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 was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
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 was deleted.
Oops, something went wrong.
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