@automattic/social-previews
Version:
A suite of components to generate previews for a post for both social and search engines.
16 lines • 1.88 kB
JavaScript
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
import { __ } from '@wordpress/i18n';
import SectionHeading from '../shared/section-heading';
import { FacebookLinkPreview } from './link-preview';
import { LinkPreviewDetails } from './link-preview-details';
import { FacebookPostPreview } from './post-preview';
export const FacebookPreviews = ({ headingLevel, hideLinkPreview, hidePostPreview, ...props }) => {
const hasMedia = !!props.media?.length;
const hasCustomImage = !!props.customImage;
return (_jsxs("div", { className: "social-preview facebook-preview", children: [!hidePostPreview && (_jsxs("section", { className: "social-preview__section facebook-preview__section", children: [_jsx(SectionHeading, { level: headingLevel, children:
// translators: refers to a social post on Facebook
__('Your post', 'social-previews') }), _jsx("p", { className: "social-preview__section-desc", children: __('This is what your social post will look like on Facebook:', 'social-previews') }), hasMedia ? _jsx(FacebookPostPreview, { ...props }) : _jsx(FacebookLinkPreview, { ...props })] })), !hideLinkPreview && (_jsxs("section", { className: "social-preview__section facebook-preview__section", children: [_jsx(SectionHeading, { level: headingLevel, children:
// translators: refers to a link to a Facebook post
__('Link preview', 'social-previews') }), _jsx("p", { className: "social-preview__section-desc", children: __('This is what it will look like when someone shares the link to your WordPress post on Facebook.', 'social-previews') }), hasCustomImage ? (_jsx(LinkPreviewDetails, { ...props })) : (_jsx(FacebookLinkPreview, { ...props, compactDescription: true, customText: "", user: undefined }))] }))] }));
};
//# sourceMappingURL=previews.js.map