class CategorySection extends HTMLElement {
static get observedAttributes() {
return ['title', 'category'];
}
constructor() {
super();
this.attachShadow({ mode: 'open' });
}
connectedCallback() {
this.render();
}
attributeChangedCallback(name, oldValue, newValue) {
if (oldValue !== newValue) {
this.render();
}
}
render() {
const title = this.getAttribute('title') || '';
const category = this.getAttribute('category') || '';
const id = this.getAttribute('id') || '';
this.shadowRoot.innerHTML = `
`;
}
getIconForCategory(category) {
const icons = {
'introducao': 'home',
'historico': 'clock',
'legislacao': 'book',
'modalidades': 'layers',
'pratica': 'activity',
'estrategia': 'target',
'comparacoes': 'columns',
'jurisprudencia': 'balance-scale'
};
return icons[category] || 'file-text';
}
}
customElements.define('category-section', CategorySection);