({
onRequestClose,
videoUrl,
imageUrl,
mediaType = 'image',
title,
description,
buttonText = 'Got it',
...props
}: ContentModalProps)
| 20 | } |
| 21 | |
| 22 | export default function ContentModal({ |
| 23 | onRequestClose, |
| 24 | videoUrl, |
| 25 | imageUrl, |
| 26 | mediaType = 'image', |
| 27 | title, |
| 28 | description, |
| 29 | buttonText = 'Got it', |
| 30 | ...props |
| 31 | }: ContentModalProps): ReactElement { |
| 32 | return ( |
| 33 | <Modal |
| 34 | kind={ModalKind.FlexibleCenter} |
| 35 | size={ModalSize.Small} |
| 36 | onRequestClose={onRequestClose} |
| 37 | isDrawerOnMobile |
| 38 | {...props} |
| 39 | > |
| 40 | <div className="flex w-full flex-col items-center"> |
| 41 | <div className="w-full rounded-t-16 bg-surface-active"> |
| 42 | {mediaType === 'video' ? ( |
| 43 | <video |
| 44 | className="aspect-video w-full border-none" |
| 45 | poster={imageUrl} |
| 46 | src={videoUrl} |
| 47 | muted |
| 48 | autoPlay |
| 49 | loop |
| 50 | playsInline |
| 51 | disablePictureInPicture |
| 52 | controls={false} |
| 53 | title={title} |
| 54 | /> |
| 55 | ) : ( |
| 56 | <img src={imageUrl} alt={title} className="h-70 w-full" /> |
| 57 | )} |
| 58 | </div> |
| 59 | <div className="flex w-full flex-col gap-4 p-6"> |
| 60 | <div className="flex flex-col gap-3"> |
| 61 | <Typography |
| 62 | type={TypographyType.Title3} |
| 63 | color={TypographyColor.Primary} |
| 64 | bold |
| 65 | > |
| 66 | {title} |
| 67 | </Typography> |
| 68 | <Typography |
| 69 | type={TypographyType.Callout} |
| 70 | color={TypographyColor.Tertiary} |
| 71 | > |
| 72 | {description} |
| 73 | </Typography> |
| 74 | </div> |
| 75 | <Button |
| 76 | variant={ButtonVariant.Primary} |
| 77 | size={ButtonSize.Medium} |
| 78 | className="mt-3 w-full" |
| 79 | onClick={onRequestClose} |
nothing calls this directly
no outgoing calls
no test coverage detected