Sort Tags By most recent, show only top 5

This commit is contained in:
Ian Minoso 2016-12-05 11:47:10 -05:00
parent 99f69c9631
commit 4dea516a40

View file

@ -42,22 +42,22 @@ class repoSidebar extends React.Component<ISidebar, {}> {
}
sortedTags = sortedTags.sort(function(a, b) {
return a.lastModified - b.lastModified;
return b.lastModified - a.lastModified;
});
sortedTags.forEach(function(el, i){
for (let i = 0; i < 5; i++){
tagRows.push(
<tr>
<td>
<i className="fa fa-tag rp-imagesTable__tagIcon" aria-hidden="true"></i>
{el.name}
{sortedTags[i].name}
</td>
<td>
{moment(el.lastModified).fromNow()}
{moment(sortedTags[i].lastModified).fromNow()}
</td>
</tr>
);
});
}
return(
<div>