import { css } from '@emotion/css'; import { useState } from 'react'; import { GrafanaTheme2 } from '@grafana/data'; import { Trans } from '@grafana/i18n'; import { Modal, Button, useStyles2, Stack, Text } from '@grafana/ui'; import { SetupStep } from './SetupStep'; import { Sidebar } from './Sidebar'; import { Step } from './types'; export interface Props { title: string; description: string; steps: Step[]; isOpen: boolean; onDismiss: () => void; } export const SetupModal = ({ title, description, steps, isOpen, onDismiss }: Props) => { const styles = useStyles2(getStyles); const [currentStep, setCurrentStep] = useState(0); const isFirstStep = currentStep === 0; const isLastStep = currentStep === steps.length - 1; const stepTitles = steps.map((step) => step.title); const handleNext = () => !isLastStep && setCurrentStep(currentStep + 1); const handlePrevious = () => !isFirstStep && setCurrentStep(currentStep - 1); return ( {description}
{isLastStep ? ( ) : ( )}
); }; const getStyles = (theme: GrafanaTheme2) => ({ modal: css({ width: '1100px', maxWidth: '95%', }), description: css({ marginBottom: theme.spacing(3), padding: theme.spacing(0, 1), }), contentWrapper: css({ flex: 1, overflowY: 'auto', minWidth: 0, padding: theme.spacing(2), borderLeft: `1px solid ${theme.colors.border.weak}`, }), footer: css({ padding: theme.spacing(2), borderTop: `1px solid ${theme.colors.border.weak}`, marginTop: theme.spacing(2), }), });