UNPKG

@automattic/social-previews

Version:

A suite of components to generate previews for a post for both social and search engines.

13 lines 544 B
import { jsx as _jsx } from "react/jsx-runtime"; import { preparePreviewText } from '../helpers'; export 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 (_jsx("div", { className: "twitter-preview__text", children: preparePreviewText(tweetText, { platform: 'twitter' }) })); }; //# sourceMappingURL=text.js.map