@cuvp1225/tango-mail
Version:
react mail components for tango
30 lines (29 loc) • 1.58 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.Email = void 0;
const tslib_1 = require("tslib");
const tango_boot_1 = require("@music163/tango-boot");
const components_1 = require("@react-email/components");
const react_1 = tslib_1.__importDefault(require("react"));
const classnames_1 = tslib_1.__importDefault(require("classnames"));
function MailView({ lang, dir, title, preview, head, fontConfig, tailwindConfig, bg, style, className, children, }) {
return (react_1.default.createElement(components_1.Html, { lang: lang, dir: dir },
react_1.default.createElement(components_1.Preview, null, preview),
react_1.default.createElement(components_1.Head, null,
react_1.default.createElement("title", null, title),
head,
fontConfig ? react_1.default.createElement(components_1.Font, Object.assign({}, fontConfig)) : null),
react_1.default.createElement(components_1.Tailwind, { config: tailwindConfig },
react_1.default.createElement(components_1.Body, { className: (0, classnames_1.default)('TangoMailBody', className), style: mailBodyStyle(Object.assign(Object.assign({}, style), { bg })) }, children))));
}
const mailBodyStyle = (style) => {
const _a = style || {}, { bg } = _a, rest = tslib_1.__rest(_a, ["bg"]);
return Object.assign(Object.assign({}, rest), { backgroundColor: bg });
};
exports.Email = (0, tango_boot_1.defineComponent)(MailView, {
name: 'Email',
designerConfig: {
hasWrapper: true,
draggable: false,
},
});