class ProjectCard extends HTMLElement { static get observedAttributes() { return ['title', 'description', 'tech', 'image']; } connectedCallback() { this.attachShadow({ mode: 'open' }); this.render(); } attributeChangedCallback() { this.render(); } render() { const title = this.getAttribute('title') || 'Project'; const description = this.getAttribute('description') || 'No description provided'; const tech = this.getAttribute('tech') || 'Various technologies'; const image = this.getAttribute('image') || 'http://static.photos/abstract/640x360/4'; this.shadowRoot.innerHTML = `

${title}

${description}

${tech}
`; } } customElements.define('project-card', ProjectCard);