@automattic/social-previews
Version:
A suite of components to generate previews for a post for both social and search engines.
18 lines • 1.46 kB
JavaScript
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
import { preparePreviewText } from '../helpers';
import { Card } from './card';
import { Footer } from './footer';
import { Header } from './header';
import { CAPTION_MAX_CHARS } from './helpers';
import { Media } from './media';
import { Sidebar } from './sidebar';
import './style.scss';
export const ThreadsPostPreview = ({ caption, date, image, media, name, profileImage, showThreadConnector, title, url, }) => {
const hasMedia = !!media?.length;
const displayAsCard = url && image && !hasMedia;
return (_jsx("div", { className: "threads-preview__wrapper", children: _jsxs("div", { className: "threads-preview__container", children: [_jsx(Sidebar, { profileImage: profileImage, showThreadConnector: showThreadConnector }), _jsxs("div", { className: "threads-preview__main", children: [_jsx(Header, { name: name, date: date }), _jsxs("div", { className: "threads-preview__content", children: [caption ? (_jsx("div", { className: "threads-preview__text", children: preparePreviewText(caption, {
platform: 'threads',
maxChars: CAPTION_MAX_CHARS,
}) })) : null, hasMedia ? _jsx(Media, { media: media }) : null, displayAsCard ? _jsx(Card, { image: image, title: title || '', url: url }) : null] }), _jsx(Footer, {})] })] }) }));
};
//# sourceMappingURL=post-preview.js.map