1
0
mirror of https://github.com/SomboChea/ui synced 2024-11-28 08:54:27 +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 React from 'react';
import { DIST_TAGS } from '../../../lib/constants'; import { DIST_TAGS } from '../../../lib/constants';
const NOT_AVAILABLE = 'Not available';
class Versions extends React.PureComponent<any> { class Versions extends React.PureComponent<any> {
render() { render() {
return ( return (
@ -32,7 +34,8 @@ class Versions extends React.PureComponent<any> {
<ListItem className={'version-item'} key={version}> <ListItem className={'version-item'} key={version}>
<ListItemText>{version}</ListItemText> <ListItemText>{version}</ListItemText>
<Spacer /> <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> </ListItem>
))} ))}
</List> </List>