import { h, render } from "https://esm.sh/preact@10"; import { useState, useRef } from "https://esm.sh/preact@10/hooks"; import { html } from "https://esm.sh/htm@3/preact"; const TESTIMONIALS = [ { name: "Sarah M.", category: "Sports Rehab Patient", initials: "SM", color: "#8ab4be", quote: "After my ACL tear I was terrified I'd never run again. The team here built a plan that had me back on the field in four months. Every session felt purposeful.", }, { name: "Leon N.", category: "Neurology Patient", initials: "LN", color: "#a3bfc8", quote: "Every new patient begins with a comprehensive diagnostic assessment. From there, they create a fully personalized treatment plan -- whether that means returning to sport, recovering from surgery, or restoring function.", }, { name: "Diana K.", category: "Surgery Rehab Patient", initials: "DK", color: "#7aa3af", quote: "Six weeks post-hip replacement and I was walking without a cane -- weeks ahead of what my surgeon expected. The therapists here are genuinely invested in your outcome, not just checking boxes.", }, { name: "Marcus T.", category: "Sports Rehab Patient", initials: "MT", color: "#6b9dab", quote: "I came in with chronic shoulder pain that three other clinics couldn't resolve. Two months in, I'm lifting overhead for the first time in years. The diagnostic process here is legitimately different.", }, { name: "Rachel O.", category: "Surgery Rehab Patient", initials: "RO", color: "#93b8c3", quote: "The booking process is seamless and the staff remembers you. I never felt like just another patient. My recovery from rotator cuff surgery exceeded every milestone.", }, { name: "James P.", category: "Neurology Patient", initials: "JP", color: "#80aab5", quote: "After my stroke the neurological therapy program here gave me my independence back. The team combined manual therapy with targeted exercise in a way that made real, measurable progress every single week.", }, ]; const CARD_W = 270; const GAP = 20; const STEP = CARD_W + GAP; const TOTAL_W = TESTIMONIALS.length * CARD_W + (TESTIMONIALS.length - 1) * GAP; function Testimonials() { const wrapRef = useRef(null); const containerRef = useRef(null); const trackRef = useRef(null); const [left, setLeft] = useState(0); function measureMax() { if (!containerRef.current) return 0; return Math.max(0, TOTAL_W - containerRef.current.offsetWidth); } var prev = function () { setLeft(function (l) { return Math.min(0, l + STEP); }); }; var next = function () { var maxL = measureMax(); setLeft(function (l) { return Math.max(-maxL, l - STEP); }); }; var atStart = left >= 0; return html`
`; } class RptTestimonials extends HTMLElement { connectedCallback() { render(html`<${Testimonials} />`, this); } disconnectedCallback() { render(null, this); } } customElements.define("rpt-testimonials", RptTestimonials);