Create individual styles for each component, add no tags messsage

This commit is contained in:
Ian Minoso 2016-11-30 00:49:52 -05:00
parent 96b9d702fe
commit 1220b85687
5 changed files with 155 additions and 137 deletions

View file

@ -33,31 +33,44 @@ class repoSidebar extends React.Component<ISidebar, {}> {
let badgeIcon: string = (this.props.isPublic) ? "rp-badge__icon--public" : "rp-badge__icon--private";
let repository: any = this.props.repository;
let sharing: string = repository.company || repository.namespace;
for (let tagObject in this.props.tags) {
sortedTags.push({
name: this.props.tags[tagObject].name,
lastModified: Date.parse(this.props.tags[tagObject].last_modified)
});
}
if (Object.keys(this.props.tags).length > 0) {
for (let tagObject in this.props.tags) {
sortedTags.push({
name: this.props.tags[tagObject].name,
lastModified: Date.parse(this.props.tags[tagObject].last_modified)
});
}
sortedTags = sortedTags.sort(function(a, b) {
return b.lastModified - a.lastModified;
});
sortedTags.slice(0,5).forEach(function(el, i){
sortedTags.slice(0,5).forEach(function(el, i){
tagRows.push(
<tr>
<td>
<i className="fa fa-tag rp-imagesTable__tagIcon" aria-hidden="true"></i>
{el.name}
</td>
<td>
{moment(el.lastModified).fromNow()}
</td>
</tr>
);
});
}
else {
tagRows.push(
<tr>
<td>
<i className="fa fa-tag rp-imagesTable__tagIcon" aria-hidden="true"></i>
{el.name}
No Tags Available
</td>
<td>
{moment(el.lastModified).fromNow()}
</td>
</tr>
);
});
)
}
return(
<div>