1
- import React from 'react' ;
1
+ import React , { Component } from 'react' ;
2
2
import { Card , CardImg , CardTitle , Badge , CardText , CardImgOverlay , Button } from 'reactstrap' ;
3
3
import Moment from 'react-moment' ;
4
+ import { postGamePurchase } from '../../actions/store/StoreAction' ;
5
+ import { connect } from 'react-redux' ;
6
+
7
+
4
8
5
9
function renderBadge ( genre ) {
6
10
let color = '' ;
@@ -20,26 +24,35 @@ function renderBadge(genre) {
20
24
)
21
25
}
22
26
23
- const ContentsCard = ( props ) => {
24
- return (
25
- < Card className = "store-game-wrapper" >
26
- < div className = "store-game-image-wrapper" >
27
- < CardImg className = "avatar-image" src = { ( props . image ) ? props . image : "http://genknews.genkcdn.vn/zoom/220_160/2017/thumbnail-4x3-34722014736-2d241425f9-k-1495531031736-crop-1495531041612.jpg" } alt = "Card image cap" />
28
- </ div >
29
- < div className = "store-game-info-wrapper" >
30
- < CardTitle > { props . title } </ CardTitle >
31
- < Moment className = "store-game-created-at" format = "YYYY/MM/DD" > { props . created_at } </ Moment >
32
- < hr />
33
- < CardText >
34
- { props . description }
35
- </ CardText >
36
- </ div >
37
- < Button color = "primary" outline > 구입하기</ Button >
38
- < CardImgOverlay >
39
- < div className = "store-game-badge" > { renderBadge ( props . genre ) } </ div >
40
- </ CardImgOverlay >
41
- </ Card >
42
- )
27
+ class ContentsCard extends Component {
28
+ render ( ) {
29
+ return (
30
+ < Card className = "store-game-wrapper" >
31
+ < div className = "store-game-image-wrapper" >
32
+ < CardImg className = "avatar-image"
33
+ src = { ( this . props . image ) ? this . props . image : "http://genknews.genkcdn.vn/zoom/220_160/2017/thumbnail-4x3-34722014736-2d241425f9-k-1495531031736-crop-1495531041612.jpg" }
34
+ alt = "Card image cap" />
35
+ </ div >
36
+ < div className = "store-game-info-wrapper" >
37
+ < CardTitle > { this . props . title } </ CardTitle >
38
+ < Moment className = "store-game-created-at" format = "YYYY/MM/DD" > { this . props . created_at } </ Moment >
39
+ < hr />
40
+ < CardText >
41
+ { this . props . description }
42
+ </ CardText >
43
+ </ div >
44
+ { /*<Button onClick={() => {this.postGamePurchase(props.idx)}} color="primary" outline>구입하기</Button>*/ }
45
+ < CardImgOverlay >
46
+ < div className = "store-game-badge" > { renderBadge ( this . props . genre ) } </ div >
47
+ </ CardImgOverlay >
48
+ < Button onClick = { ( ) => {
49
+ this . props . postGamePurchase ( this . props . idx )
50
+ } } > 구입하기</ Button >
51
+ </ Card >
52
+ )
53
+ }
43
54
}
44
55
45
- export default ContentsCard ;
56
+ // export default ContentsCard;
57
+
58
+ export default connect ( null , { postGamePurchase} ) ( ContentsCard ) ;
0 commit comments