Skip to content

Commit 3c889a2

Browse files
authored
Merge pull request #123 from serverdev-bewe/develop
Develop
2 parents e80acce + 8f6e989 commit 3c889a2

File tree

4 files changed

+39
-24
lines changed

4 files changed

+39
-24
lines changed
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,10 @@
1-
import React from 'react';
1+
import React, { Component } from 'react';
22
import { Card, CardImg, CardTitle, Badge, CardText, CardImgOverlay, Button } from 'reactstrap';
33
import Moment from 'react-moment';
4+
import {postGamePurchase} from '../../actions/store/StoreAction';
5+
import {connect} from 'react-redux';
6+
7+
48

59
function renderBadge(genre) {
610
let color = '';
@@ -20,26 +24,35 @@ function renderBadge(genre) {
2024
)
2125
}
2226

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+
}
4354
}
4455

45-
export default ContentsCard;
56+
// export default ContentsCard;
57+
58+
export default connect(null, {postGamePurchase})(ContentsCard);

FRONTEND/ReactReduxVer_1/src/components/CMS/ContentsList.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ class ContentsList extends Component{
1919
return this.props.contents.map((data, index) => {
2020
return (
2121
<ContentsDetail
22-
key={data.idx}
22+
idx={data.idx}
2323
index={index+1}
2424
flag={data.flag}
2525
title={data.title}

FRONTEND/ReactReduxVer_1/src/components/store/StoreLists.js

+2-1
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,10 @@ class StoreLists extends Component{
1616

1717
renderLists(){
1818
return this.props.contents.map((data, index) => {
19+
console.log('data',data);
1920
return (
2021
<ContentsCard
21-
key={data.key}
22+
idx={data.idx}
2223
index={index+1}
2324
title={data.title}
2425
genre={data.genre}

FRONTEND/ReactReduxVer_1/src/components/users/dashboard/profile/UserGame.js

+1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import React, { Component } from 'react';
2+
import { PulseLoader } from 'react-spinners';
23

34
import { connect } from 'react-redux';
45
import { NavLink } from 'react-router-dom';

0 commit comments

Comments
 (0)