@cuvp1225/tango-mail
Version:
react mail components for tango
26 lines (25 loc) • 1.07 kB
JavaScript
import { __rest } from "tslib";
import React from 'react';
import { defineComponent } from '@music163/tango-boot';
import { Placeholder } from '../placeholder';
function SectionView(_a) {
var { p = '0', children, bg, color, style } = _a, props = __rest(_a, ["p", "children", "bg", "color", "style"]);
return (React.createElement("table", Object.assign({ align: "center", width: "100%", border: 0, cellPadding: p, cellSpacing: "0", role: "presentation", style: getTableStyle({ bg, color, style }) }, props),
React.createElement("tbody", null,
React.createElement("tr", null,
React.createElement("td", null, children)))));
}
function getTableStyle({ bg, color, style, }) {
return Object.assign({ backgroundColor: bg, color }, style);
}
export const Section = defineComponent(SectionView, {
name: 'Section',
designerConfig: {
defaultProps: {
children: React.createElement(Placeholder, null),
style: {
border: '1px dashed #999',
},
},
},
});