Files
claude-code/src/components/wizard/WizardDialogLayout.tsx
2026-04-07 15:05:03 +08:00

49 lines
1.1 KiB
TypeScript

import React, { type ReactNode } from 'react'
import type { Theme } from '../../utils/theme.js'
import { Dialog } from '../design-system/Dialog.js'
import { useWizard } from './useWizard.js'
import { WizardNavigationFooter } from './WizardNavigationFooter.js'
type Props = {
title?: string
color?: keyof Theme
children: ReactNode
subtitle?: string
footerText?: ReactNode
}
export function WizardDialogLayout({
title: titleOverride,
color = 'suggestion',
children,
subtitle,
footerText,
}: Props): ReactNode {
const {
currentStepIndex,
totalSteps,
title: providerTitle,
showStepCounter,
goBack,
} = useWizard()
const title = titleOverride || providerTitle || 'Wizard'
const stepSuffix =
showStepCounter !== false ? ` (${currentStepIndex + 1}/${totalSteps})` : ''
return (
<>
<Dialog
title={`${title}${stepSuffix}`}
subtitle={subtitle}
onCancel={goBack}
color={color}
hideInputGuide
isCancelActive={false}
>
{children}
</Dialog>
<WizardNavigationFooter instructions={footerText} />
</>
)
}