@automattic/social-previews
Version:
A suite of components to generate previews for a post for both social and search engines.
17 lines • 686 B
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.Text = void 0;
const jsx_runtime_1 = require("react/jsx-runtime");
const helpers_1 = require("../helpers");
const Text = ({ text, url, retainUrl }) => {
if (!text) {
return null;
}
// If the text ends with the card URL, remove it.
const tweetText = url && !retainUrl && text.endsWith(url)
? text.substring(0, text.lastIndexOf(url))
: text;
return ((0, jsx_runtime_1.jsx)("div", { className: "twitter-preview__text", children: (0, helpers_1.preparePreviewText)(tweetText, { platform: 'twitter' }) }));
};
exports.Text = Text;
//# sourceMappingURL=text.js.map