Created
July 2, 2020 18:09
-
-
Save Eyongkevin/c9fd97ca9398561a5aa8ba385be74376 to your computer and use it in GitHub Desktop.
sample code for the tut `Build a Shopping Cart with React, Redux, and React-DnD`
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Phone extends Component{ | |
render(){ | |
const { brand } = this.props; | |
const { isDragging, connectDragSource } = this.props; | |
const opacity = isDragging? 0.4: 1; | |
const style={ | |
opacity: opacity | |
}; | |
const phoneClass = isDragging? 'ui card phone drag': 'ui card phone'; | |
return connectDragSource( | |
<div className={phoneClass} style={style}> | |
<div className="image"><img src="/images/phone.jpg" /></div> | |
<div className="content"> | |
<div className="phone-name">{ brand }</div> | |
<div className="meta">8G RAM, 16G memory</div> | |
</div> | |
<div className="extra content"> | |
<a> | |
<i aria-hidden="true" className="money icon"></i> | |
$ 80 | |
</a> | |
</div> | |
</div> | |
) | |
} | |
} | |
export default DragSource(ItemTypes.PHONE, phoneSpec, collect)(Phone); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment