@automattic/social-previews
Version:
A suite of components to generate previews for a post for both social and search engines.
17 lines • 937 B
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
const jsx_runtime_1 = require("react/jsx-runtime");
const helpers_1 = require("../helpers");
const helpers_2 = require("./helpers");
const CustomText = ({ text, url, forceUrlDisplay }) => {
let postLink;
if (forceUrlDisplay || (0, helpers_1.hasTag)(text, 'a')) {
postLink = ((0, jsx_runtime_1.jsx)("a", { className: "facebook-preview__custom-text-post-url", href: url, rel: "nofollow noopener noreferrer", target: "_blank", children: url }));
}
return ((0, jsx_runtime_1.jsxs)("p", { className: "facebook-preview__custom-text", children: [(0, jsx_runtime_1.jsx)("span", { children: (0, helpers_1.preparePreviewText)(text, {
platform: 'facebook',
maxChars: helpers_2.CUSTOM_TEXT_LENGTH,
}) }), postLink] }));
};
exports.default = CustomText;
//# sourceMappingURL=custom-text.js.map