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 () {
|
render () {
|
||||||
return (<Textfield label={this.props.label}
|
return (<Textfield
|
||||||
|
style={{ width: '100%' }}
|
||||||
|
label={this.props.label}
|
||||||
floatingLabel
|
floatingLabel
|
||||||
rows={this.props.rows}
|
rows={this.props.rows}
|
||||||
value={this.state.value}
|
value={this.state.value}
|
||||||
|
@ -6,11 +6,13 @@ const {
|
|||||||
} = require('react-mdl');
|
} = require('react-mdl');
|
||||||
const { Link } = require('react-router');
|
const { Link } = require('react-router');
|
||||||
|
|
||||||
|
export const shorten = (str, len = 50) => (str && str.length > len ? `${str.substring(0, len)}...` : str);
|
||||||
|
|
||||||
export const AppsLinkList = ({ apps }) => (
|
export const AppsLinkList = ({ apps }) => (
|
||||||
<List style={{ textAlign: 'left' }}>
|
<List style={{ textAlign: 'left' }}>
|
||||||
{apps.length > 0 && apps.map(({ appName, description = '-', icon = 'apps' }) => (
|
{apps.length > 0 && apps.map(({ appName, description = '-', icon = 'apps' }) => (
|
||||||
<ListItem twoLine key={appName}>
|
<ListItem twoLine key={appName}>
|
||||||
<ListItemContent avatar={icon} subtitle={description}>
|
<ListItemContent avatar={icon} subtitle={shorten(description)}>
|
||||||
<Link key={appName} to={`/applications/${appName}`}>
|
<Link key={appName} to={`/applications/${appName}`}>
|
||||||
{appName}
|
{appName}
|
||||||
</Link>
|
</Link>
|
||||||
|
@ -3,6 +3,7 @@ import { Link } from 'react-router';
|
|||||||
import { Chip, Switch, Icon, IconButton } from 'react-mdl';
|
import { Chip, Switch, Icon, IconButton } from 'react-mdl';
|
||||||
import percentLib from 'percent';
|
import percentLib from 'percent';
|
||||||
import Progress from './progress';
|
import Progress from './progress';
|
||||||
|
import { shorten } from '../common';
|
||||||
|
|
||||||
import style from './feature.scss';
|
import style from './feature.scss';
|
||||||
|
|
||||||
@ -41,7 +42,7 @@ const Feature = ({
|
|||||||
<Switch title="test" key="left-actions" onChange={() => onFeatureClick(feature)} checked={enabled} />
|
<Switch title="test" key="left-actions" onChange={() => onFeatureClick(feature)} checked={enabled} />
|
||||||
</span>
|
</span>
|
||||||
<Link to={`/features/edit/${name}`} className={style.link}>
|
<Link to={`/features/edit/${name}`} className={style.link}>
|
||||||
{name} <small>{(description && description.substring(0, 30)) || ''}</small>
|
{name} <small>{shorten(description, 30) || ''}</small>
|
||||||
</Link>
|
</Link>
|
||||||
</span>
|
</span>
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user