forked from open-sauced/open-sauced
/
RepoListItem.js
42 lines (40 loc) 路 1.32 KB
/
RepoListItem.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
import React from "react";
import {FlexStart, FloatRight, FloatLeft, FlexColumn, FlexHeader, FlexCenter} from "../styles/Grid";
import {StarIcon} from "@primer/octicons-react";
import Avatar from "../styles/Avatar";
import {chevronRight} from "../icons";
import {humanizeNumber} from "../lib/humanizeNumber";
import {truncate} from "../lib/truncate";
function RepoListItem({goal, stars}) {
return (
<FlexHeader>
<FloatLeft>
<FlexCenter>
<Avatar
alt="avatar"
src={`https://avatars.githubusercontent.com/${goal.full_name.split("/")[0].replace(/\s+/g, "")}`}
/>
<FlexColumn className="details">
<p>{truncate(goal.full_name.replace(/\s+/g, ""), 60)}</p>
{stars >= 0 ? (
<FlexStart style={{alignItems: "flex-start"}}>
<div>
<StarIcon alt="star" verticalAlign="middle" />
</div>
<p>{humanizeNumber(stars)}</p>
</FlexStart>
) : (
<p><i>Sync in Progress</i></p>
)}
</FlexColumn>
</FlexCenter>
</FloatLeft>
<FloatRight>
<FlexCenter>
<img alt="pointing right icon" src={chevronRight} />
</FlexCenter>
</FloatRight>
</FlexHeader>
);
}
export default RepoListItem;