00Boobs00's picture
Review revise and update with refactoring, refinement and optimization expanding this out to at least 4 times its origional size and magnitude.
3bcb678 verified
```javascript
class TabsContainer extends HTMLElement {
constructor() {
super();
this.attachShadow({ mode: 'open' });
}
connectedCallback() {
this.render();
this.attachEvents();
}
render() {
this.shadowRoot.innerHTML = `
<style>
:host {
display: block;
}
.tabs-header {
display: flex;
gap: 1px;
border-bottom: 2px solid #1e293b;
margin-bottom: 1.5rem;
}
.tab-button {
padding: 0.75rem 1.5rem;
background: transparent;
border: none;
color: #94a3b8;
cursor: pointer;
font-size: 14px;
font-weight: 500;
transition: all 0.2s;
position: relative;
}
.tab-button:hover {
color: #e2e8f0;
}
.tab-button.active {
color: #10b981;
}
.tab-button.active::after {
content: '';
position: absolute;
bottom: -2px;
left: 0;
right: 0;
height: 2px;
background: #10b981;
}
.tab-panel {
display: none;
}
.tab-panel.active {
display: block;
}
::slotted(tab-panel) {
display: none;
}
::slotted(tab-panel[active]) {
display: block;
}
</style>
<div class="tabs-header">
<button class="tab-button active" data-tab="general">General</button>
<button class="tab-button" data-tab="performance">Performance</button>
<button class="tab-button" data-tab="security">Security</button>
<button class="tab-button" data-tab="advanced">Advanced</button>
</div>
<slot></slot>
`;
}
attachEvents() {
const buttons = this.shadowRoot.querySelectorAll('.tab-button');
const panels = this.querySelectorAll('tab-panel');
buttons.forEach(button => {
button.addEventListener('click', () => {
const tabId = button.dataset.tab;
buttons.forEach(b => b.classList.remove('active'));
button.classList.add('active');
panels.forEach(panel => {
panel.removeAttribute('active');
if (panel.id === tabId) {
panel.setAttribute('active', '');
}
});
});
});
}
}
customElements.define('tabs-container', TabsContainer);
class TabPanel extends HTMLElement {
connectedCallback() {
this.style.display = this.hasAttribute('active') ? 'block' : 'none';
}
static get observedAttributes() {
return
___METADATA_START___
{"repoId":"00Boobs00/omniloop-ai","isNew":false,"userName":"00Boobs00"}
___METADATA_END___