/** @format */ /** * External dependencies */ import { Component } from '@wordpress/element'; import PropTypes from 'prop-types'; /** * A component that loads an image, allowing images to be loaded relative to the main asset/plugin folder. * Props are passed through to `` */ class ImageAsset extends Component { render() { const { src, alt, ...restOfProps } = this.props; let illustrationSrc = src; if ( illustrationSrc.indexOf( '/' ) === 0 ) { illustrationSrc = illustrationSrc.substring( 1 ); illustrationSrc = wcSettings.wcAdminAssetUrl + illustrationSrc; } return {; } } ImageAsset.propTypes = { /** * Image location to pass through to ``. */ src: PropTypes.string.isRequired, /** * Alt text to pass through to ``. */ alt: PropTypes.string.isRequired, }; export default ImageAsset;