({
index,
onClick,
photo,
margin,
direction,
top,
left,
key,
})
| 12 | const imgWithClick = { cursor: "pointer" }; |
| 13 | |
| 14 | const Photo = ({ |
| 15 | index, |
| 16 | onClick, |
| 17 | photo, |
| 18 | margin, |
| 19 | direction, |
| 20 | top, |
| 21 | left, |
| 22 | key, |
| 23 | }) => { |
| 24 | const imgStyle = { margin: margin, display: "block" }; |
| 25 | if (direction === "column") { |
| 26 | imgStyle.position = "absolute"; |
| 27 | imgStyle.left = left; |
| 28 | imgStyle.top = top; |
| 29 | } |
| 30 | |
| 31 | const handleClick = (event) => { |
| 32 | onClick(event, { photo, index }); |
| 33 | }; |
| 34 | |
| 35 | return ( |
| 36 | <img |
| 37 | key={key} |
| 38 | style={onClick ? { ...imgStyle, ...imgWithClick } : imgStyle} |
| 39 | {...photo} |
| 40 | onClick={onClick ? handleClick : null} |
| 41 | /> |
| 42 | ); |
| 43 | }; |
| 44 | |
| 45 | export const photoPropType = PropTypes.shape({ |
| 46 | key: PropTypes.string, |
nothing calls this directly
no outgoing calls
no test coverage detected