Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[OffcanvasHeader.js] Update API for HTML standard, simplify attribute naming, & migrate to named slots #216

Open
wants to merge 5 commits into
base: dev
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 10 additions & 12 deletions src/components/atoms/OffcanvasHeader/OffcanvasHeader.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,21 +41,21 @@ export default class OffcanvasHeader extends HTMLElement {

connectedCallback() {
// Nav attributes
const parentID = this.getAttribute('data-parent-id');
const btnDark = this.getAttribute('data-button-dark');
const extraClasses = this.getAttribute('data-extra-classes');
const parentID = this.getAttribute('parent-id');
const btnDark = this.getAttribute('button-dark');
const extraClasses = this.getAttribute('extra-classes');
const offcanvasHeaderClasses = ['offcanvas-header'];
this.offcanvasTitle.className = 'offcanvas-title';
this.offcanvasTitle.id = `${parentID}-label`;
this.closeBtn.setAttribute('data-img-alt', '');
this.closeBtn.setAttribute('data-icon', '');
this.closeBtn.setAttribute('data-close', 'true');
this.closeBtn.setAttribute('data-bs-dismiss', parentID);
this.closeBtn.setAttribute('img-alt', '');
this.closeBtn.setAttribute('icon', '');
this.closeBtn.setAttribute('close', 'true');
this.closeBtn.setAttribute('bs-dismiss', parentID);
extraClasses ? offcanvasHeaderClasses.push(extraClasses) : 0;
btnDark === 'true'
? this.closeBtn.setAttribute('data-extra-classes', 'btn-close-white')
? this.closeBtn.setAttribute('extra-classes', 'btn-close-white')
: 0;
const expand = this.getAttribute('data-expand');
const expand = this.getAttribute('expand');
if (expand) {
expand === 'always'
? offcanvasHeaderClasses.push('navbar-expand')
Expand All @@ -73,8 +73,6 @@ export default class OffcanvasHeader extends HTMLElement {
}

_onClick() {
this.getRootNode()
.host.getRootNode()
.host.setAttribute('data-show', 'false');
this.getRootNode().host.getRootNode().host.setAttribute('show', 'false');
}
}
Loading