/** * WordPress dependencies */ import { Dashicon } from '@safe-wordpress/components'; import { _x } from '@safe-wordpress/i18n'; /** * External dependencies */ import { castArray, compact, take } from 'lodash'; import { SocialMessageTextPreview } from '@nelio-content/components'; import { dateI18n } from '@nelio-content/date'; /** * Internal dependencies */ import './style.scss'; import { MaybeSharedLink } from './maybe-shared-link'; import type { PreviewAttributes } from '../../../hooks'; export const LinePreview = ( attrs: PreviewAttributes ): JSX.Element => { const { schedule, textComputed, type } = attrs; return (
{ [ 'image', 'video', 'multi-media' ].includes( type ) && ( ) } { ! [ 'image', 'video', 'multi-media' ].includes( type ) && ( ) }
{ dateI18n( ' H:i', schedule ) }
); }; const MediaPreview = ( attrs: PreviewAttributes ): JSX.Element => { const { image } = attrs; const images = take( compact( [ ...castArray( image ?? [] ) ] ), 5 ); return (
{ images.map( ( img, i ) => (
{
) ) }
); };