|
1 | 1 | import React from "react";
|
2 | 2 | import Header from "../components/Header";
|
3 | 3 | import Footer from "../components/Footer";
|
| 4 | +import { getMembers } from "./../redux/actions/members"; |
| 5 | +import { connect } from "react-redux"; |
| 6 | +import propTypes from "prop-types"; |
4 | 7 |
|
5 | 8 | export class Members extends React.Component {
|
6 |
| - constructor() { |
7 |
| - super(); |
8 |
| - this.state = { |
9 |
| - members: [ |
10 |
| - { |
11 |
| - id: 1, |
12 |
| - name: "ISHIMWE URBAIN", |
13 |
| - bio: "Kigali,Rwanda", |
14 |
| - profileURL: |
15 |
| - "https://versions.bulma.io/0.7.0/images/placeholders/1280x960.png", |
16 |
| - details: |
17 |
| - "Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua." |
18 |
| - }, |
19 |
| - { |
20 |
| - id: 2, |
21 |
| - name: "ISHIMWE URBAIN", |
22 |
| - bio: "Kigali,Rwanda", |
23 |
| - profileURL: |
24 |
| - "https://versions.bulma.io/0.7.0/images/placeholders/1280x960.png", |
25 |
| - details: |
26 |
| - "Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua." |
27 |
| - }, |
28 |
| - { |
29 |
| - id: 3, |
30 |
| - name: "ISHIMWE URBAIN", |
31 |
| - bio: "Kigali,Rwanda", |
32 |
| - profileURL: |
33 |
| - "https://versions.bulma.io/0.7.0/images/placeholders/1280x960.png", |
34 |
| - details: |
35 |
| - "Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua." |
36 |
| - }, |
37 |
| - { |
38 |
| - id: 4, |
39 |
| - name: "ISHIMWE URBAIN", |
40 |
| - bio: "Kigali,Rwanda", |
41 |
| - profileURL: |
42 |
| - "https://versions.bulma.io/0.7.0/images/placeholders/1280x960.png", |
43 |
| - details: |
44 |
| - "Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua." |
45 |
| - }, |
46 |
| - { |
47 |
| - id: 5, |
48 |
| - name: "ISHIMWE URBAIN", |
49 |
| - bio: "Kigali,Rwanda", |
50 |
| - profileURL: |
51 |
| - "https://versions.bulma.io/0.7.0/images/placeholders/1280x960.png", |
52 |
| - details: |
53 |
| - "Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua." |
54 |
| - }, |
55 |
| - { |
56 |
| - id: 6, |
57 |
| - name: "ISHIMWE URBAIN", |
58 |
| - bio: "Kigali,Rwanda", |
59 |
| - profileURL: |
60 |
| - "https://versions.bulma.io/0.7.0/images/placeholders/1280x960.png", |
61 |
| - details: |
62 |
| - "Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua." |
63 |
| - } |
64 |
| - ] |
65 |
| - }; |
| 9 | + constructor(props) { |
| 10 | + super(props); |
| 11 | + this.state = {}; |
| 12 | + this.props.getMembers(); |
66 | 13 | document.title = "Rwanda Open Source - Members";
|
67 | 14 | }
|
68 | 15 |
|
69 | 16 | render() {
|
| 17 | + const { members, status } = this.props; |
| 18 | + { |
| 19 | + console.log(status); |
| 20 | + } |
70 | 21 | return (
|
71 | 22 | <div className="page-container section">
|
72 | 23 | <Header />
|
73 | 24 | <h1 className="title is-4 has-text-centered">
|
74 | 25 | RWANDA OPEN SOURCE MEMBERS
|
75 | 26 | </h1>
|
76 |
| - <div className="container members"> |
77 |
| - <div className="wrapper"> |
78 |
| - {this.state.members.map(member => ( |
79 |
| - <div className="member" key={member.id}> |
80 |
| - <div className="member-card"> |
81 |
| - <img className="member-image" src={member.profileURL} alt /> |
82 |
| - <div className="card-content"> |
83 |
| - <div className="member-details has-text-centered"> |
84 |
| - <h3 className="name">{member.name}</h3> |
85 |
| - <p className="bio">{member.bio}</p> |
| 27 | + {status == 200 ? ( |
| 28 | + <div className="container members"> |
| 29 | + <div className="wrapper"> |
| 30 | + {members.map((member) => ( |
| 31 | + <div className="member" key={member.id}> |
| 32 | + <div className="member-card"> |
| 33 | + <img className="member-image" src={member.profileURL} alt /> |
| 34 | + <div className="card-content"> |
| 35 | + <div className="member-details has-text-centered"> |
| 36 | + <h3 className="name">{member.name}</h3> |
| 37 | + <p className="bio">{member.location}</p> |
| 38 | + </div> |
| 39 | + <div className="content">{member.bio}</div> |
86 | 40 | </div>
|
87 |
| - <div className="content">{member.details}</div> |
88 | 41 | </div>
|
89 | 42 | </div>
|
90 |
| - </div> |
91 |
| - ))} |
| 43 | + ))} |
| 44 | + </div> |
| 45 | + <div className="buttons"> |
| 46 | + <button className="button is-grey"> |
| 47 | + <i className="fas fa-plus is-white fas-space"></i>Show more |
| 48 | + </button> |
| 49 | + </div> |
92 | 50 | </div>
|
93 |
| - <div className="buttons"> |
94 |
| - <button className="button is-grey"> |
95 |
| - <i className="fas fa-plus is-white fas-space"></i>Show more |
96 |
| - </button> |
97 |
| - </div> |
98 |
| - </div> |
| 51 | + ) : ( |
| 52 | + <div className="members-not-found"></div> |
| 53 | + )} |
99 | 54 | <Footer />
|
100 | 55 | </div>
|
101 | 56 | );
|
102 | 57 | }
|
103 | 58 | }
|
104 | 59 |
|
105 |
| -export default Members; |
| 60 | +Members.defaultProps = { |
| 61 | + members: [], |
| 62 | + status: 0, |
| 63 | + getMembers, |
| 64 | +}; |
| 65 | + |
| 66 | +Members.propTypes = { |
| 67 | + members: propTypes.array, |
| 68 | + status: propTypes.number, |
| 69 | + getMembers: propTypes.func, |
| 70 | +}; |
| 71 | + |
| 72 | +const mapStateToProps = ({ Members }) => ({ |
| 73 | + members: Members.members, |
| 74 | + status: Members.status, |
| 75 | +}); |
| 76 | + |
| 77 | +const mapDispatchToProps = (dispatch) => ({ |
| 78 | + getMembers: async () => getMembers(dispatch), |
| 79 | +}); |
| 80 | + |
| 81 | +export default connect(mapStateToProps, mapDispatchToProps)(Members); |
0 commit comments