@cuvp1225/tango-mail
Version:
react mail components for tango
27 lines (26 loc) • 1.24 kB
JavaScript
import { __rest } from "tslib";
import { defineComponent } from '@music163/tango-boot';
import { Body, Font, Head, Html, Preview, Tailwind, } from '@react-email/components';
import React from 'react';
import cx from 'classnames';
function MailView({ lang, dir, title, preview, head, fontConfig, tailwindConfig, bg, style, className, children, }) {
return (React.createElement(Html, { lang: lang, dir: dir },
React.createElement(Preview, null, preview),
React.createElement(Head, null,
React.createElement("title", null, title),
head,
fontConfig ? React.createElement(Font, Object.assign({}, fontConfig)) : null),
React.createElement(Tailwind, { config: tailwindConfig },
React.createElement(Body, { className: cx('TangoMailBody', className), style: mailBodyStyle(Object.assign(Object.assign({}, style), { bg })) }, children))));
}
const mailBodyStyle = (style) => {
const _a = style || {}, { bg } = _a, rest = __rest(_a, ["bg"]);
return Object.assign(Object.assign({}, rest), { backgroundColor: bg });
};
export const Email = defineComponent(MailView, {
name: 'Email',
designerConfig: {
hasWrapper: true,
draggable: false,
},
});