Skip to content

Commit

Permalink
Set up componenet constructor and styles
Browse files Browse the repository at this point in the history
  • Loading branch information
sreidthomas committed Jan 8, 2025
1 parent 00b1076 commit 8ddfedd
Showing 1 changed file with 26 additions and 3 deletions.
29 changes: 26 additions & 3 deletions src/stable/components/organisms/GovBanner/GovBanner.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import bootstrapStyles from '!!raw-loader!../../../../shared/themed-bootstrapSty


const template = document.createElement('template');

template.innerHTML = `
<div part="container" class="banner-container">
<header part="header" class="banner-header">
Expand All @@ -18,11 +18,34 @@ template.innerHTML = `
</div>
</div>
<button part="toggle" class="chevron-container" aria-expanded="false" aria-controls="content">
<slot name="toggle-icon"></slot>
<slot name="toggle-icon"></slot>
</button>
</header>
<div id="content" part="content" class="content-container" hidden>
<slot name="content"></slot>
</div>
</div>
`;
`;

class GovBanner extends HTMLElement {

Check failure on line 30 in src/stable/components/organisms/GovBanner/GovBanner.js

View workflow job for this annotation

GitHub Actions / format_and_lint

'GovBanner' is defined but never used
constructor(){

// Always call super first in constructor
super();

// Create a shadow root
const shadow = this.attachShadow({ mode: 'open' });
shadow.appendChild(template.content.cloneNode(true));

// Add Styles
const bootStyles = document.createElement('style');
bootStyles.textContent = bootstrapStyles;
const variableStyles = document.createElement('style');
variableStyles.textContent = varStyles;
const itemStyles = document.createElement('style');
itemStyles.textContent = styles;
shadow.appendChild(bootStyles);
shadow.appendChild(variableStyles);
shadow.appendChild(itemStyles);
}
}

0 comments on commit 8ddfedd

Please sign in to comment.