-
Notifications
You must be signed in to change notification settings - Fork 56
/
Copy pathHomeShowcase.js
72 lines (68 loc) · 2.17 KB
/
HomeShowcase.js
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
import React from "react";
import { Link } from "react-router-dom";
import axios from "axios";
import Card from "../../common/Card";
import Button from "../../common/Button";
import Preloader from "../../common/Preloader";
class HomeShowcase extends React.Component {
constructor(props) {
super(props);
this.state = {
isFetching: true,
projects: []
};
this.fetchProjects = this.fetchProjects.bind(this);
this.fetchProjects();
}
fetchProjects() {
axios
.get(`${process.env.AJAX_ROOT}/api/demos/projects/`)
.then(response => {
this.setState({ projects: response.data, isFetching: false });
})
.catch(error => {
//Redirect
});
}
render() {
const SHOWCASE_TITLE = "PROJECTS";
return (
<div className="cv-home-showcase cv-container">
{!this.state.isFetching && (
<div>
<h1 className="cv-home-showcase-heading">{SHOWCASE_TITLE}</h1>
<div className="cv-home-showcase-content">
{this.state.projects.map((project, index) => {
return (
<Card key={index} extraClass="cv-home-showcase-card">
<div className="cv-home-showcase-card-image">
<img src={project.image} />
</div>
<div className="cv-home-showcase-links">
<Link to={project.github_url} target="_blank">
<Button extraClass="cv-button-small">GitHub</Button>
</Link>
<Link
to={project.documentation_url}
target="_blank"
rel="noopener noreferrer"
>
<Button
themeClass="cv-button-dark"
extraClass="cv-button-small"
>
Documentation
</Button>
</Link>
</div>
</Card>
);
})}
</div>
</div>
)}
</div>
);
}
}
export default HomeShowcase;