import { getMediaQueryList, isMobile, MOBILE_BREAKPOINT } from '@automattic/viewport'; import { Button, Card, CardBody, CardFooter, CardMedia } from '@wordpress/components'; import { Icon } from '@wordpress/icons'; import { useI18n } from '@wordpress/react-i18n'; import classnames from 'classnames'; import WpcomTourKitRating from './wpcom-tour-kit-rating'; import WpcomTourKitStepCardNavigation from './wpcom-tour-kit-step-card-navigation'; import WpcomTourKitStepCardOverlayControls from './wpcom-tour-kit-step-card-overlay-controls'; import type { WpcomTourStepRendererProps } from '../../../types'; const WpcomTourKitStepCard: React.FunctionComponent< WpcomTourStepRendererProps > = ( { steps, currentStepIndex, onMinimize, onDismiss, onGoToStep, onNextStep, onPreviousStep, setInitialFocusedElement, } ) => { const { __ } = useI18n(); const lastStepIndex = steps.length - 1; const { descriptions, heading, imgSrc, imgLink } = steps[ currentStepIndex ].meta; const isLastStep = currentStepIndex === lastStepIndex; const description = descriptions[ isMobile() ? 'mobile' : 'desktop' ] ?? descriptions.desktop; // @todo check why the assertion is needed here to pass TS const mediaQueryList = getMediaQueryList( MOBILE_BREAKPOINT ) as MediaQueryList | undefined; return ( { imgSrc && ( { imgSrc.mobile && ( ) } { { imgLink && ( } size={ 27 } /> ) } ) }

{ heading }

{ description } { isLastStep ? ( ) : null }

{ isLastStep ? ( ) : ( ) }
); }; export default WpcomTourKitStepCard;