(props: Props)
| 9 | } |
| 10 | |
| 11 | export function SingleImage(props: Props) { |
| 12 | const {filePair, side} = props; |
| 13 | if (!filePair[side]) { |
| 14 | return null; // or: return empty <img> same size as other image? |
| 15 | } |
| 16 | |
| 17 | const url = side == 'a' ? '/a/image/' + filePair.a : '/b/image/' + filePair.b; |
| 18 | const im = _.clone(side === 'a' ? filePair.image_a : filePair.image_b); |
| 19 | let scaleDown = 1.0; |
| 20 | const {maxWidth} = props; |
| 21 | if (maxWidth !== null && maxWidth < im.width) { |
| 22 | scaleDown = maxWidth / im.width; |
| 23 | im.width *= scaleDown; |
| 24 | im.height *= scaleDown; |
| 25 | } |
| 26 | const diffBoxDiv = makePerceptualBoxDiv(props.pdiffMode, filePair, scaleDown); |
| 27 | |
| 28 | return ( |
| 29 | <div className="image-holder"> |
| 30 | {diffBoxDiv} |
| 31 | <img className={'side-' + side} src={url} width={im.width} height={im.height} /> |
| 32 | </div> |
| 33 | ); |
| 34 | } |
nothing calls this directly
no test coverage detected