devdazzle-delights / components /feature-card.js
sheetwise's picture
https://lovable.dev/
3ed22ff verified
Raw History Blame Contribute Delete
2.01 kB
class CustomFeatureCard extends HTMLElement {
connectedCallback() {
const icon = this.getAttribute('icon') || 'box';
const title = this.getAttribute('title') || 'Feature';
const description = this.getAttribute('description') || 'Feature description goes here';
this.attachShadow({ mode: 'open' });
this.shadowRoot.innerHTML = `
<style>
.feature-icon {
width: 48px;
height: 48px;
display: flex;
align-items: center;
justify-content: center;
border-radius: 12px;
background-color: #e0e7ff;
color: #6366f1;
margin-bottom: 1.5rem;
}
.feature-title {
font-weight: 600;
font-size: 1.25rem;
margin-bottom: 0.75rem;
color: #111827;
}
.feature-description {
color: #6b7280;
line-height: 1.6;
}
.feature-card {
padding: 2rem;
border-radius: 0.5rem;
background-color: white;
box-shadow: 0 1px 3px rgba(0,0,0,0.1);
transition: all 0.3s ease;
}
.feature-card:hover {
transform: translateY(-5px);
box-shadow: 0 10px 25px rgba(0,0,0,0.1);
}
</style>
<div class="feature-card animate-on-scroll">
<div class="feature-icon">
<i data-feather="${icon}"></i>
</div>
<h3 class="feature-title">${title}</h3>
<p class="feature-description">${description}</p>
</div>
`;
}
}
customElements.define('custom-feature-card', CustomFeatureCard);