-
Notifications
You must be signed in to change notification settings - Fork 87
Expand file tree
/
Copy pathindex.js
More file actions
85 lines (75 loc) · 1.69 KB
/
Copy pathindex.js
File metadata and controls
85 lines (75 loc) · 1.69 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
/*
*
* ViewProject
*
*/
import React, { PropTypes } from 'react';
import { connect } from 'react-redux';
import { Grid, Row, Col } from 'react-flexbox-grid';
import { Card } from '../../components/Card';
import projectData from '../../data.json';
let id;
const styles = {
mainDiv: {
padding: '20px',
width: '100%',
textAlign: 'center',
},
image: {
height: '200px',
borderRadius: '5px',
},
center: {
textAlign: 'center',
},
hr: {
width: '80%',
height: '3px',
backgroundColor: 'black',
},
};
export class ViewProject extends React.PureComponent { // eslint-disable-line react/prefer-stateless-function
constructor(props) {
super(props);
this.props = props;
this.state = {
project: {},
};
}
componentWillMount() {
id = this.props.params.id;
this.setState({
project: projectData.projects[id - 1],
});
}
render() {
return (
<div>
<Grid fluid>
<Row>
<Col lg={12}>
<header className="app-header"></header>
<div style={styles.mainDiv}>
<div>
<img src={this.state.project.image} style={styles.image} alt="project logo" />
</div>
<h1> {this.state.project.text} </h1>
<hr style={styles.hr} />
<h2>Author : {this.state.project.title} </h2>
<p>
{this.state.project.text}
</p>
</div>
</Col>
</Row>
</Grid>
</div>
);
}
}
function mapDispatchToProps(dispatch) {
return {
dispatch,
};
}
export default connect(null, mapDispatchToProps)(ViewProject);