File size: 1,954 Bytes
509f3c2 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 |
class CustomStep extends HTMLElement {
constructor() {
super();
this.number = this.getAttribute('number') || '1';
this.icon = this.getAttribute('icon') || 'check';
this.title = this.getAttribute('title') || 'Step';
this.description = this.getAttribute('description') || 'Description';
this.delay = this.getAttribute('delay') || '0';
}
connectedCallback() {
this.attachShadow({ mode: 'open' });
this.shadowRoot.innerHTML = `
<style>
:host {
display: block;
animation-delay: ${this.delay}ms;
}
.step-card {
text-align: center;
padding: 1.5rem;
opacity: 0;
animation: fadeIn 0.5s ease-out ${this.delay}ms forwards;
}
@keyframes fadeIn {
to {
opacity: 1;
}
}
.step-number {
width: 4rem;
height: 4rem;
margin: 0 auto 1.5rem;
border-radius: 50%;
display: flex;
align-items: center;
justify-content: center;
font-weight: bold;
font-size: 1.5rem;
background: linear-gradient(135deg, #22c55e, #d946ef);
color: white;
font-size: 1.875rem;
}
.step-icon {
width: 1.5rem;
height: 1.5rem;
color: white;
}
h3 {
font-size: 1.5rem;
font-weight: 600;
margin-bottom: 0.75rem;
}
p {
color: #9ca3af;
}
</style>
<div class="step-card">
<div class="step-number">
<i data-feather="${this.icon}" class="step-icon"></i>
</div>
<h3>${this.title}</h3>
<p>${this.description}</p>
</div>
`;
setTimeout(() => {
if (typeof feather !== 'undefined') {
feather.replace();
}
}, 100);
}
}
customElements.define('custom-step', CustomStep); |