// @flow /** * This component is intended to be passed to TemplateContainer as templateComponent prop, like this: * */ import * as React from 'react'; import Button from '../../../../components/button/Button'; import PrimaryButton from '../../../../components/primary-button/PrimaryButton'; import Overlay from '../../../../components/flyout/Overlay'; import MessagePreviewContent from '../../../message-preview-content/MessagePreviewContent'; import type { Token } from '../../../../common/types/core'; import type { MessageActions, PreviewTitleBodyTwoButtonsParams} from '../../types'; import './styles/PreviewTitleBodyTwoButtonsPopoutTemplate.scss'; type Props = { apiHost: string, contentPreviewProps?: ContentPreviewProps, getToken: (folderID: string | number) => Promise, onAction: (MessageActions, ...Array) => any, params: PreviewTitleBodyTwoButtonsParams, }; const handleButtonClick = (onAction, button) => { if (button) { onAction(button.actions); } }; const PreviewTitleBodyTwoButtonsPopoutTemplate = ({ apiHost, contentPreviewProps, getToken, onAction, params: { body, button1, button2, fileUpload: { fileId, sharedLinkUrl } = {}, title }, }: Props) => { return (
{/* eslint-disable react/no-danger */}
{/* eslint-enable react/no-danger */}
{button2 && ( )} handleButtonClick(onAction, button1)} > {button1.label}
); }; export default PreviewTitleBodyTwoButtonsPopoutTemplate;