1
0
mirror of https://github.com/Unleash/unleash.git synced 2025-02-04 00:18:01 +01:00

feat: added time-ago to toggle-list

This commit is contained in:
Ivar Conradi Østhus 2020-08-07 10:08:23 +02:00
parent f5ed3eaa1f
commit 303b6edb99
3 changed files with 14 additions and 3 deletions

View File

@ -38,7 +38,9 @@
"prepublish": "npm run build"
},
"main": "./index.js",
"dependencies": {},
"dependencies": {
"react-timeago": "^4.4.0"
},
"devDependencies": {
"@babel/core": "^7.9.0",
"@babel/plugin-proposal-class-properties": "^7.8.3",

View File

@ -81,3 +81,8 @@
text-transform: none;
font-weight: normal;
}
.toggleName {
color: #37474f !important;
font-weight: 500;
}

View File

@ -2,6 +2,7 @@ import React from 'react';
import PropTypes from 'prop-types';
import { Link } from 'react-router-dom';
import { Switch, Chip, ListItem, ListItemAction, Icon } from 'react-mdl';
import TimeAgo from 'react-timeago';
import Progress from './progress';
import { UPDATE_FEATURE } from '../../permissions';
import { calc, styles as commonStyles } from '../common';
@ -18,7 +19,7 @@ const Feature = ({
revive,
hasPermission,
}) => {
const { name, description, enabled, type, stale } = feature;
const { name, description, enabled, type, stale, createdAt } = feature;
const { showLastHour = false } = settings;
const isStale = showLastHour ? metricsLastHour.isFallback : metricsLastMinute.isFallback;
const percent =
@ -47,7 +48,10 @@ const Feature = ({
</span>
<span className={['mdl-list__item-primary-content', styles.listItemLink].join(' ')}>
<Link to={featureUrl} className={[commonStyles.listLink, commonStyles.truncate].join(' ')}>
{name}
<span className={commonStyles.toggleName}>{name}&nbsp;</span>
<small className="mdl-color-text--blue-grey-300">
<TimeAgo date={createdAt} />
</small>
<span className={['mdl-list__item-sub-title', commonStyles.truncate].join(' ')}>{description}</span>
</Link>
</span>