Aviation169's picture
Add more components and feature
cb48938 verified
class CustomTestimonials extends HTMLElement {
constructor() {
super();
this.attachShadow({ mode: 'open' });
this.testimonials = [
{
name: "Sarah Johnson",
role: "Frontend Developer",
content: "These components saved me countless hours of development time. The quality is exceptional and they integrate seamlessly with my projects.",
avatar: "http://static.photos/people/200x200/1"
},
{
name: "Michael Chen",
role: "UI Designer",
content: "As a designer, I appreciate the attention to detail in these components. They're beautiful out of the box but also easy to customize.",
avatar: "http://static.photos/people/200x200/2"
},
{
name: "Emma Rodriguez",
role: "Product Manager",
content: "Our team's productivity has increased dramatically since we started using these components. Highly recommended!",
avatar: "http://static.photos/people/200x200/3"
}
];
this.render();
}
render() {
this.shadowRoot.innerHTML = `
<style>
:host {
display: block;
}
.testimonials-container {
max-width: 1200px;
margin: 0 auto;
}
.section-title {
text-align: center;
font-size: 2rem;
font-weight: 700;
margin-bottom: 3rem;
color: #111827;
}
.testimonials-grid {
display: grid;
grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
gap: 2rem;
}
.testimonial-card {
background-color: white;
border-radius: 0.5rem;
padding: 2rem;
box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
transition: all 0.3s ease;
}
.testimonial-card:hover {
transform: translateY(-5px);
box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
}
.testimonial-content {
font-style: italic;
color: #4b5563;
margin-bottom: 1.5rem;
line-height: 1.6;
}
.testimonial-author {
display: flex;
align-items: center;
gap: 1rem;
}
.author-avatar {
width: 50px;
height: 50px;
border-radius: 50%;
object-fit: cover;
}
.author-info {
display: flex;
flex-direction: column;
}
.author-name {
font-weight: 600;
color: #111827;
}
.author-role {
color: #6b7280;
font-size: 0.875rem;
}
</style>
<div class="testimonials-container">
<h2 class="section-title">What People Are Saying</h2>
<div class="testimonials-grid">
${this.testimonials.map(testimonial => `
<div class="testimonial-card">
<p class="testimonial-content">"${testimonial.content}"</p>
<div class="testimonial-author">
<img src="${testimonial.avatar}" alt="${testimonial.name}" class="author-avatar">
<div class="author-info">
<span class="author-name">${testimonial.name}</span>
<span class="author-role">${testimonial.role}</span>
</div>
</div>
</div>
`).join('')}
</div>
</div>
`;
}
}
customElements.define('custom-testimonials', CustomTestimonials);