import React from 'react';
import ProjectsDisplay from './ProjectDisplay';

class ProjectsList extends React.Component {
    constructor(props)
    {
      super(props);
      console.log(this.props);
      this.elementVisible = this.elementVisible.bind(this);
    }

    elementVisible(iElement)
    {
      this.props.parentComponent.elementVisible(iElement);
    }

    render() {
      var dispProjects = []
      for(const [index, value] of this.props.projects.details.entries())
      {
        dispProjects.push(
          <ProjectsDisplay proj={value} key={index} parentComponent={this}></ProjectsDisplay>
        );
      }
      return <React.Fragment>
        {dispProjects}
        </React.Fragment>
    }
  }

export default ProjectsList