import React from 'react';
import { Box, Heading, Text, LinearProgressBar } from '@wix/design-system';
import { useWixPatternsContainer } from '@wix/bex-core/react';
export interface SetupWidgetHeaderProps {
/** Defaults to the translated "Setup" when omitted. */
title?: string | null;
completedCount: number;
totalCount: number;
progressPercentage: number;
isMobile: boolean;
}
/**
* Widget header: title + "X/Y completed" ratio + progress bar.
* - Desktop: title left, ratio + bar inline on the right.
* - Mobile: large heading stacked above the ratio and a full-width bar.
*/
export const SetupWidgetHeader = ({
title,
completedCount,
totalCount,
progressPercentage,
isMobile,
}: SetupWidgetHeaderProps) => {
const { translate: t } = useWixPatternsContainer();
const resolvedTitle = title ?? t('cairo.setupWidget.title');
const ratioLabel = t('cairo.setupWidget.progress.label', {
completed: completedCount,
total: totalCount,
});
if (isMobile) {
// Mobile (per Figma): the "X/Y" ratio sits inline to the left of the bar
// (no "completed" word) to save vertical space. The ratio is just numbers,
// so it needs no translation.
const ratio = `${completedCount}/${totalCount}`;
return (
{resolvedTitle}
{ratio}
);
}
return (
{resolvedTitle}
{ratioLabel}
);
};