()
| 37 | }; |
| 38 | |
| 39 | render() { |
| 40 | const { accepts, isOver, canDrop, connectDropTarget, lastDroppedItem } = this.props; |
| 41 | const isActive = isOver && canDrop; |
| 42 | |
| 43 | let backgroundColor = '#222'; |
| 44 | if (isActive) { |
| 45 | backgroundColor = 'darkgreen'; |
| 46 | } else if (canDrop) { |
| 47 | backgroundColor = 'darkkhaki'; |
| 48 | } |
| 49 | |
| 50 | return connectDropTarget( |
| 51 | <div style={{ ...style, backgroundColor }}> |
| 52 | {isActive ? |
| 53 | 'Release to drop' : |
| 54 | `This dustbin accepts: ${accepts.join(', ')}` |
| 55 | } |
| 56 | |
| 57 | {lastDroppedItem && |
| 58 | <p>Last dropped: {JSON.stringify(lastDroppedItem)}</p> |
| 59 | } |
| 60 | </div>, |
| 61 | ); |
| 62 | } |
| 63 | } |
nothing calls this directly
no outgoing calls
no test coverage detected