/** * WordPress dependencies */ import { _x } from '@safe-wordpress/i18n'; /** * External dependencies */ import { castArray } from 'lodash'; import { SocialProfileIcon } from '@nelio-content/components'; import { usePost } from '@nelio-content/data'; import { dateI18n } from '@nelio-content/date'; /** * Internal dependencies */ import './style.scss'; import type { PreviewAttributes } from '../../../hooks'; export const MediumPreview = ( { activeProfile: { id: profileId, displayName }, postId, schedule, image: originalImage, }: PreviewAttributes ): JSX.Element | null => { const post = usePost( postId ); if ( ! post ) { return null; } const image = castArray( originalImage )[ 0 ]; const imageTag = image ? `
${
				post.title ?? ''
		  }
` : ''; const content = `${ imageTag }${ post?.content ?? '' }`; return (
{ post?.title }
{ displayName }
{ dateI18n( _x( 'F j, Y', 'text (Instagram preview date)', 'nelio-content' ), schedule ) }
/g, '' ), } } >
); };