| 1 |
import React from "react"; |
| 2 |
|
| 3 |
// Card-style skeleton matching the FAQ list rows. Renders roughly as many rows |
| 4 |
// as the group actually has (`count`) so the accordion opens straight to ~its |
| 5 |
// final height — otherwise a large group animates open to a fixed 3-row |
| 6 |
// skeleton and then jumps when the taller real list swaps in. Capped at 10 so |
| 7 |
// it never overshoots the body's ~575px scroll area. |
| 8 |
const FaqLoader = ({ count }) => { |
| 9 |
const rows = Math.min(Math.max(Number(count) || 3, 1), 10); |
| 10 |
return ( |
| 11 |
<div className="bd-faq-skeleton bd-faq-skeleton--faq"> |
| 12 |
{Array.from({ length: rows }).map((_, i) => ( |
| 13 |
<div className="bd-faq-skeleton__card" key={i}> |
| 14 |
<span className="bd-faq-skeleton__grip" /> |
| 15 |
<span className="bd-faq-skeleton__text"> |
| 16 |
<span className="bd-faq-skeleton__line bd-faq-skeleton__line--title" /> |
| 17 |
</span> |
| 18 |
<span className="bd-faq-skeleton__toggle" /> |
| 19 |
<span className="bd-faq-skeleton__icon" /> |
| 20 |
<span className="bd-faq-skeleton__icon" /> |
| 21 |
<span className="bd-faq-skeleton__icon" /> |
| 22 |
</div> |
| 23 |
))} |
| 24 |
</div> |
| 25 |
); |
| 26 |
}; |
| 27 |
|
| 28 |
export default FaqLoader; |
| 29 |
|