| class TestimonialsSlider extends HTMLElement { | |
| connectedCallback() { | |
| this.attachShadow({ mode: 'open' }); | |
| this.shadowRoot.innerHTML = ` | |
| <style> | |
| :host { | |
| display: block; | |
| padding: 2rem 0; | |
| background: var(--light); | |
| } | |
| .testimonials-container { | |
| max-width: 1200px; | |
| margin: 0 auto; | |
| padding: 0 20px; | |
| } | |
| .testimonials-title { | |
| text-align: center; | |
| margin-bottom: 2rem; | |
| color: var(--dark); | |
| } | |
| .testimonials-slider { | |
| display: flex; | |
| overflow-x: auto; | |
| scroll-snap-type: x mandatory; | |
| gap: 1rem; | |
| padding: 1rem 0; | |
| -webkit-overflow-scrolling: touch; | |
| } | |
| .testimonial-card { | |
| min-width: 300px; | |
| scroll-snap-align: start; | |
| background: white; | |
| border-radius: 12px; | |
| padding: 1.5rem; | |
| box-shadow: 0 4px 12px rgba(0,0,0,0.05); | |
| } | |
| .testimonial-content { | |
| font-style: italic; | |
| margin-bottom: 1rem; | |
| color: var(--dark); | |
| } | |
| .testimonial-author { | |
| display: flex; | |
| align-items: center; | |
| gap: 0.5rem; | |
| } | |
| .author-avatar { | |
| width: 40px; | |
| height: 40px; | |
| border-radius: 50%; | |
| object-fit: cover; | |
| } | |
| .author-info { | |
| display: flex; | |
| flex-direction: column; | |
| } | |
| .author-name { | |
| font-weight: 600; | |
| color: var(--dark); | |
| } | |
| .author-role { | |
| font-size: 0.8rem; | |
| color: var(--gray); | |
| } | |
| </style> | |
| <div class="testimonials-container"> | |
| <h2 class="testimonials-title">Vad våra kunder säger</h2> | |
| <div class="testimonials-slider"> | |
| <div class="testimonial-card"> | |
| <p class="testimonial-content"> | |
| "SafeSwitch har revolutionerat vår bilhandel. Inga mer oro för bedrägerier eller försenade betalningar." | |
| </p> | |
| <div class="testimonial-author"> | |
| <img src="http://static.photos/people/120x120/1" alt="Anders" class="author-avatar"> | |
| <div class="author-info"> | |
| <span class="author-name">Anders Lundberg</span> | |
| <span class="author-role">VD, Lundbergs Bil</span> | |
| </div> | |
| </div> | |
| </div> | |
| <div class="testimonial-card"> | |
| <p class="testimonial-content"> | |
| "Som privatperson känner jag mig trygg med SafeSwitch. Allt är tydligt och lagligt." | |
| </p> | |
| <div class="testimonial-author"> | |
| <img src="http://static.photos/people/120x120/2" alt="Maria" class="author-avatar"> | |
| <div class="author-info"> | |
| <span class="author-name">Maria Svensson</span> | |
| <span class="author-role">Privatkund</span> | |
| </div> | |
| </div> | |
| </div> | |
| </div> | |
| </div> | |
| `; | |
| } | |
| } | |
| customElements.define('testimonials-slider', TestimonialsSlider); |