Fakultas Ilmu Komputer UI

ApplicantList.jsx 1.2 KB
Newer Older
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
import React from 'react';
import { Item } from 'semantic-ui-react';
import Applicant from './Applicant';
import Server from '../lib/Server';

export default class ApplicantList extends React.Component {

  static propTypes = {
    url: React.PropTypes.string.isRequired,
    companyId: React.PropTypes.number.isRequired,
    status: React.PropTypes.string,
  };

  static defaultProps = {
    status: 'Unbookmarked',
  };

  constructor(props) {
    super(props);
    /* istanbul ignore next */
    /*
    Server.get(this.props.url, false).then((data) => {
      this.setState({ applications: data });
    });
    */
    this.state = { applications: [{id:1, name:"Farasdak", description:"huehuehuehue", bookmarked:0, jurusan:"Ilmu Komputer", application:"Software Engineer"}], bookmarkList: [] };
    this.generateApplicants = this.generateApplicants.bind(this);
  }


  generateApplicants() {
    console.log(this.state.applications)
    return this.state.applications.map(application =>
      <Applicant
        key={application.id}
        status={this.props.status}
        data={application}
      />,
    );
  }

  render = () => (
    <Item.Group relaxed>
      { this.generateApplicants() }
    </Item.Group>
  );
}