import { __ } from '@wordpress/i18n'; import { Image, User } from 'lucide-react'; import { Avatar } from '@bsf/force-ui'; import { cn, decodeHtmlEntities } from '@Functions/utils'; import GlobalRemoveButton from '@AdminComponents/global-remove-image-button'; const getDateString = ( type ) => { const date = new Date(); const month = date.toLocaleString( 'default', { month: 'long' } ); const day = date.getDate(); const year = date.getFullYear().toString().slice( -2 ); if ( 'twitter' === type ) { return `${ day } ${ month } ${ year }`; } return `${ month } ${ day }`; }; const ImagePlaceholder = ( { className, ...props } ) => (
); const SocialPreview = ( { displayName = 'Name', username = '@username', type = 'facebook', title = __( 'Sample Post - Testing Site', 'surerank' ), description = '', imageURL = '', siteURL = 'surerank.com', twitterLargePreview = false, onClickRemove, hideRemoveButton = true, } ) => { let designContent = null; const decoded_description = decodeHtmlEntities( description ); const decoded_title = decodeHtmlEntities( title ); const descriptionContent = decoded_description || ''; switch ( type ) { case 'twitter': designContent = (
{ /* Header */ }

{ displayName }

{ username } . { getDateString( 'twitter' ) }

{ imageURL ? (
thumbnail { ! hideRemoveButton && ( ) }
) : ( ) }

{ siteURL }

{ decoded_title }

{ descriptionContent }

); break; case 'facebook': designContent = ( <> { /* Image */ }
{ imageURL ? (
Social Post { ! hideRemoveButton && ( ) }
) : ( ) }
{ /* Footer */ }

{ siteURL }

{ decoded_title }

{ descriptionContent }

); break; default: designContent = null; break; } return (
{ designContent }
); }; export default SocialPreview;