/*
 * Copyright 2020 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     https://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

/**
 * Internal dependencies
 */
import StoryPropTypes from '../../types';
import VisibleImage from '../media/visibleImage';
import { calculateSrcSet } from '../media/util';

function ImageLayerContent({
  element: {
    resource,
    resource: { src, alt },
  },
}) {
  return (
    <VisibleImage
      src={src}
      srcSet={calculateSrcSet(resource)}
      alt={alt}
      height="20"
    />
  );
}

ImageLayerContent.propTypes = {
  element: StoryPropTypes.element.isRequired,
};

export default ImageLayerContent;

@@ -723,31 +723,38 @@
 mport %7B 
-calculateSrcSet
+getSmallestUrlForWidth
  %7D from 
@@ -846,13 +846,8 @@
 e: %7B
- src,
  alt
@@ -866,20 +866,65 @@
 %7B%0A  
+const src = getSmallestUrlForWidth(0, resource);%0A  
 return
- (%0A   
  %3CVi
@@ -933,22 +933,16 @@
 bleImage
-%0A     
  src=%7Bsr
@@ -947,55 +947,8 @@
 src%7D
-%0A      srcSet=%7BcalculateSrcSet(resource)%7D%0A     
  alt
@@ -957,14 +957,8 @@
 alt%7D
-%0A     
  hei
@@ -969,19 +969,11 @@
 %2220%22
-%0A    /%3E%0A  )
+ /%3E
 ;%0A%7D%0A

Optimize layer thumbnail