import React from 'react';
import { Card, Box, SkeletonGroup, SkeletonLine } from '@wix/design-system';
const SKELETON_ROW_COUNT = 4;
// Wrap in a full-width *vertical* Box: a flex column stretches the SkeletonGroup
// to the container width, so the SkeletonLine's `%` resolves against the row/card
// (a horizontal wrapper lets the group shrink to content, making lines narrow).
const Line = ({ width }: { width: string }) => (
);
/**
* Built-in loading skeleton shaped like the widget — a header (title +
* progress bar) over a list of step-row placeholders. Mirrors the success
* layout (card-wrapped on desktop, bare on mobile) so there's no layout jump
* when the data resolves.
*/
export const SetupWidgetSkeleton = ({
isMobile,
dataHook,
}: {
isMobile: boolean;
dataHook?: string;
}) => {
// Header skeleton mirrors SetupWidgetHeader's layout so the progress-bar area
// is reserved too (no jump when data resolves):
// - Mobile: title, ratio text, then a full-width bar — all stacked.
// - Desktop: title on the left; ratio + a 220px bar inline on the right.
const header = isMobile ? (
{/* progress bar */}
) : (
// No fixed widths: title and progress-bar lines each `flex={1}` (equal
// share), and the `gap` guarantees space between them at any card width.
{/* title */}
{/* progress bar */}
);
const body = (
{header}
{/* step rows */}
{Array.from({ length: SKELETON_ROW_COUNT }).map((_, index) => (
))}
);
// Mobile renders bare (no outer card), matching the success layout.
if (isMobile) {
return (
{body}
);
}
return (
{body}
);
};