-
Notifications
You must be signed in to change notification settings - Fork 13.3k
Expand file tree
/
Copy pathGenericUpsellModal.tsx
More file actions
55 lines (50 loc) · 1.38 KB
/
GenericUpsellModal.tsx
File metadata and controls
55 lines (50 loc) · 1.38 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
import { Box, ModalHeroImage } from '@rocket.chat/fuselage';
import { GenericModal } from '@rocket.chat/ui-client';
import type { ReactElement, ComponentProps } from 'react';
import { useTranslation } from 'react-i18next';
type GenericUpsellModalProps = Omit<ComponentProps<typeof GenericModal>, 'variant' | 'children' | 'onClose' | 'onDismiss'> & {
subtitle?: string | ReactElement;
description?: string | ReactElement;
img: ComponentProps<typeof ModalHeroImage>['src'];
imgWidth?: ComponentProps<typeof ModalHeroImage>['width'];
imgHeight?: ComponentProps<typeof ModalHeroImage>['height'];
imgAlt?: string;
onClose: () => void;
onConfirm?: () => void;
};
const GenericUpsellModal = ({
tagline,
subtitle,
img,
imgAlt = '',
imgWidth,
imgHeight,
description,
confirmText,
icon = null,
...props
}: GenericUpsellModalProps) => {
const { t } = useTranslation();
return (
<GenericModal
{...props}
icon={icon}
tagline={tagline ?? t('Premium_capability')}
variant='upsell'
confirmText={confirmText ?? t('Upgrade')}
>
<ModalHeroImage src={img} alt={imgAlt} width={imgWidth} height={imgHeight} />
{subtitle && (
<Box is='h3' fontScale='h3'>
{subtitle}
</Box>
)}
{description && (
<Box style={{ whiteSpace: 'break-spaces' }} fontScale='p2' mbs={16}>
{description}
</Box>
)}
</GenericModal>
);
};
export default GenericUpsellModal;