import React, { type MouseEventHandler, useState } from 'react'; import { Button } from '../Button'; import { Dots } from '../Dots'; import { ModalBody } from '../Modal/ModalBody'; import { ModalHeaderWithIllustration } from '../Modal/ModalHeaderWithIllustration'; import { ModalFooter } from '../Modal/ModalFooter'; import type { DeprecatedModalSlideshowSlide } from './types'; import { useId } from '../../hooks/useId'; import styles from './DeprecatedModalSlideShowBody.module.css'; export type DeprecatedModalSlideshowBodyProps = { /** * The slides to display in the ModalSlideshow. */ slides: DeprecatedModalSlideshowSlide[]; /** * Handler that is called after the last slide has been displayed. */ onDone: MouseEventHandler; /** * Handler that is called to cancel the slideshow. */ onCancel: MouseEventHandler; /** * The translations for the buttons. */ translations: { cancel: string; previous: string; next: string; done: string; }; }; export const DeprecatedModalSlideshowBody = ({ slides, translations, onCancel, onDone, }: DeprecatedModalSlideshowBodyProps) => { const prefixId = useId(); const [currentIndex, setCurrentIndex] = useState(0); const isFirstItem = currentIndex === 0; const isLastItem = slides.length - 1 === currentIndex; return ( <>
{slides.map((slide, index) => (
{slide.content}
))}