// @flow import * as React from 'react'; import PrimaryButton from '../../../../components/primary-button'; import { Modal, ModalActions } from '../../../../components/modal'; import Button from '../../../../components/button'; import MessagePreviewContent from '../../../message-preview-content/MessagePreviewContent'; import type { Token } from '../../../../common/types/core'; import { messageActions } from '../../types/message-actions'; import { type MessageActions, type PreviewTitleBodyTwoButtonsParams } from '../../types'; import './styles/PreviewTitleBodyTwoButtonsModalTemplate.scss'; type Props = { apiHost: string, contentPreviewProps?: ContentPreviewProps, getToken: (folderID: string | number) => Promise, onAction: (MessageActions, ...Array) => any, params: PreviewTitleBodyTwoButtonsParams, }; const handleClose = onAction => { onAction([messageActions.close]); }; const handleButtonClick = (onAction, button) => { if (button) { onAction(button.actions); } }; const PreviewTitleBodyTwoButtonsModalTemplate = ({ apiHost, contentPreviewProps, getToken, onAction, params: { body, button1, button2, fileUpload: { fileId, sharedLinkUrl } = {}, title }, }: Props) => { return ( handleClose(onAction)} shouldNotUsePortal >
{/* eslint-disable react/no-danger */}
{/* eslint-enable react/no-danger */}
handleButtonClick(onAction, button1)}> {button1.label} {button2 && ( )}
); }; export default PreviewTitleBodyTwoButtonsModalTemplate;