mirror of
https://github.com/Unleash/unleash.git
synced 2025-01-20 00:08:02 +01:00
shorten description with ellipse
This commit is contained in:
parent
b4e600afd9
commit
87fe8f5c66
@ -15,7 +15,9 @@ class StatefulTextfield extends Component {
|
||||
}
|
||||
|
||||
render () {
|
||||
return (<Textfield label={this.props.label}
|
||||
return (<Textfield
|
||||
style={{ width: '100%' }}
|
||||
label={this.props.label}
|
||||
floatingLabel
|
||||
rows={this.props.rows}
|
||||
value={this.state.value}
|
||||
|
@ -6,11 +6,13 @@ const {
|
||||
} = require('react-mdl');
|
||||
const { Link } = require('react-router');
|
||||
|
||||
export const shorten = (str, len = 50) => (str && str.length > len ? `${str.substring(0, len)}...` : str);
|
||||
|
||||
export const AppsLinkList = ({ apps }) => (
|
||||
<List style={{ textAlign: 'left' }}>
|
||||
{apps.length > 0 && apps.map(({ appName, description = '-', icon = 'apps' }) => (
|
||||
<ListItem twoLine key={appName}>
|
||||
<ListItemContent avatar={icon} subtitle={description}>
|
||||
<ListItemContent avatar={icon} subtitle={shorten(description)}>
|
||||
<Link key={appName} to={`/applications/${appName}`}>
|
||||
{appName}
|
||||
</Link>
|
||||
|
@ -3,6 +3,7 @@ import { Link } from 'react-router';
|
||||
import { Chip, Switch, Icon, IconButton } from 'react-mdl';
|
||||
import percentLib from 'percent';
|
||||
import Progress from './progress';
|
||||
import { shorten } from '../common';
|
||||
|
||||
import style from './feature.scss';
|
||||
|
||||
@ -41,7 +42,7 @@ const Feature = ({
|
||||
<Switch title="test" key="left-actions" onChange={() => onFeatureClick(feature)} checked={enabled} />
|
||||
</span>
|
||||
<Link to={`/features/edit/${name}`} className={style.link}>
|
||||
{name} <small>{(description && description.substring(0, 30)) || ''}</small>
|
||||
{name} <small>{shorten(description, 30) || ''}</small>
|
||||
</Link>
|
||||
</span>
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user