1
0
mirror of https://github.com/SomboChea/ui synced 2024-11-05 06:04:28 +07:00

fix: version rendering issue. (#38)

* fix: object passing for react rendering

* fix: const for 'not available'

* fix: const for 'not available'
This commit is contained in:
Ayush Sharma 2019-04-28 13:15:45 +02:00 committed by Juan Picado @jotadeveloper
parent fc114298ad
commit e8fd59696e

View File

@ -11,6 +11,8 @@ import ListItem from '@material-ui/core/ListItem/index';
import React from 'react';
import { DIST_TAGS } from '../../../lib/constants';
const NOT_AVAILABLE = 'Not available';
class Versions extends React.PureComponent<any> {
render() {
return (
@ -32,7 +34,8 @@ class Versions extends React.PureComponent<any> {
<ListItem className={'version-item'} key={version}>
<ListItemText>{version}</ListItemText>
<Spacer />
<ListItemText>{isVersion && timeMap[version] ? `${formatDateDistance(timeMap[version])} ago` : packages[version]}</ListItemText>
{isVersion && <ListItemText>{timeMap[version] ? `${formatDateDistance(timeMap[version])} ago` : NOT_AVAILABLE}</ListItemText>}
{isVersion === false && <ListItemText>{packages[version]}</ListItemText>}
</ListItem>
))}
</List>