All files / src/pages/IndvOrganization RenderProjectCard.js

40% Statements 2/5
100% Branches 0/0
0% Functions 0/2
40% Lines 2/5

Press n or j to go to the next uncovered block, b, p or k for the previous block.

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        61x         61x                                              
import ProjectCard from '../../components/ProjectCard';
import Grid from '@material-ui/core/Grid';
import React from 'react';
 
const calculateDaysSince = (updateTime) => {
  const days = new Date() - new Date(updateTime);
  return Math.round(days / (1000 * 3600 * 24));
};
 
export const renderCard = (project) => {
  return (
    <Grid item style={{ paddingTop: '10px' }} key={project.id}>
      {' '}
      <ProjectCard
        projectUrl={project.html_url}
        organizationUrl={project.owner.html_url}
        organizationAvatarUrl={project.owner.avatar_url}
        ownerName={project.owner.login}
        projectName={project.name}
        projectDescription={project.description}
        homepage={project.homepage}
        lastUpdate={calculateDaysSince(project.updated_at)}
        issueCount={project.open_issues}
        projectLanguage={project.language}
        topics={project.topics}
        watchers={project.watchers_count}
        stargazers={project.stargazers_count}
        projectTags={project.parentOrgs}
      />
    </Grid>
  );
};