type Props = { boxes?: number; timing?: number; width: number; }; export default function Loading({ boxes = 3, timing = 0.1, width }: Props) { // each box is just an empty div const divs = []; // allow a custom number of pulsing boxes (defaults to 3) for (let i = 0; i < boxes; i++) { // width of each box correlates with number of boxes (with a little padding) // each individual box's animation has a staggered start in corresponding order divs.push(
); } return (
{divs}
); }