class CustomSimulationCard extends HTMLElement {
constructor() {
super();
this.attachShadow({ mode: 'open' });
}
static get observedAttributes() {
return ['title', 'description', 'image', 'link'];
}
attributeChangedCallback(name, oldValue, newValue) {
this.render();
}
connectedCallback() {
this.render();
}
render() {
const title = this.getAttribute('title') || 'Simulation';
const description = this.getAttribute('description') || 'Interactive biomedical lab simulation';
const image = this.getAttribute('image') || 'http://static.photos/science/640x360/1';
const link = this.getAttribute('link') || '#';
this.shadowRoot.innerHTML = `
${title}
${description}
Start Simulation
`;
// Replace feather icons after rendering
if (feather) {
feather.replace();
}
}
}
customElements.define('custom-simulation-card', CustomSimulationCard);