diff --git a/modules/search/instant-search/components/photon-image.jsx b/modules/search/instant-search/components/photon-image.jsx new file mode 100644 index 000000000000..9f63e5d6c428 --- /dev/null +++ b/modules/search/instant-search/components/photon-image.jsx @@ -0,0 +1,15 @@ +/** @jsx h */ + +/** + * External dependencies + */ +import { h } from 'preact'; +import photon from 'photon'; + +const PhotonImage = ( { src, maxWidth = 300, maxHeight = 300, alt, ...otherProps } ) => { + const photonSrc = photon( src, { resize: `${ maxWidth },${ maxHeight }` } ); + + return {; +}; + +export default PhotonImage; diff --git a/modules/search/instant-search/components/search-result-product.jsx b/modules/search/instant-search/components/search-result-product.jsx index e4cc86d29ea2..ccddc0559888 100644 --- a/modules/search/instant-search/components/search-result-product.jsx +++ b/modules/search/instant-search/components/search-result-product.jsx @@ -9,6 +9,7 @@ import { h, Component } from 'preact'; * Internal dependencies */ import SearchResultComments from './search-result-comments'; +import PhotonImage from './photon-image'; class SearchResultProduct extends Component { render() { @@ -34,7 +35,7 @@ class SearchResultProduct extends Component { /> { firstImage && ( -