File "ImagePreview.js"
Full path: /home/webcknlt/admissiontell.com/wp-content/plugins/seo-by-rank-math/includes/modules/schema/blocks/shared/ImagePreview.js
File
size: 557 B (557 B bytes)
MIME-type: text/plain
Charset: utf-8
Download Open Edit Advanced Editor &nnbsp; Back
/**
* Internal dependencies
*/
import { getImageByID } from '@helpers/imageHelper'
/**
* WordPress dependencies
*/
import { withSelect } from '@wordpress/data'
/**
* Render image from image id.
*
* @param {string} imageUrl Image url.
*/
const ImagePreview = ( { imageUrl } ) => {
if ( ! imageUrl ) {
return null
}
return <img src={ imageUrl } alt="" />
}
export default withSelect( ( select, props ) => {
const { imageID, sizeSlug } = props
return {
imageUrl: imageID ? getImageByID( imageID, sizeSlug ) : null,
}
} )( ImagePreview )