react-email-builder
Version:
A simple React drag and drop email builder.
37 lines (36 loc) • 1.64 kB
JavaScript
"use strict";
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.ButtonBlock = void 0;
const react_1 = __importDefault(require("react"));
const hooks_1 = require("../../../hooks");
function ButtonBlock({ block }) {
const style = (0, hooks_1.useBlockStyle)(block);
const attrs = block.attrs;
const p = attrs.padding || [];
const nil = undefined;
return (react_1.default.createElement("div", { style: { ...style, textAlign: attrs.align } },
react_1.default.createElement("a", { style: {
display: attrs.block === 'yes' ? 'block' : 'inline-block',
paddingTop: p[0] ?? nil,
paddingRight: p[1] ?? nil,
paddingBottom: p[2] ?? nil,
paddingLeft: p[3] ?? nil,
backgroundColor: attrs.bgColor,
color: attrs.color,
borderRadius: attrs.borderRadius,
fontFamily: attrs.fontFamily,
fontSize: attrs.fontSize,
lineHeight: attrs.lineHeight == null ? '' : attrs.lineHeight + '%',
fontWeight: attrs.fontWeight,
letterSpacing: attrs.letterSpacing,
cursor: 'pointer',
wordBreak: 'break-word',
textDecoration: attrs.textDecoration || 'none'
}, href: attrs.url, target: attrs.target, onClick: (e) => {
e.preventDefault();
} }, attrs.text)));
}
exports.ButtonBlock = ButtonBlock;