1
0
mirror of https://github.com/ascribe/onion.git synced 2024-12-22 09:23:13 +01:00

Use class to add overflow ellipsis instead of directly styling component

This commit is contained in:
Brett Sun 2015-12-23 10:20:56 +01:00
parent 6419a4e8e0
commit d817b920b4
2 changed files with 8 additions and 9 deletions

View File

@ -35,27 +35,20 @@ const DetailProperty = React.createClass({
const {
children,
className,
ellipsis,
label,
labelClassName,
separator,
valueClassName,
value } = this.props;
const styles = this.props.ellipsis ? {
whiteSpace: 'nowrap',
overflow: 'hidden',
textOverflow: 'ellipsis'
} : null;
return (
<div className={classNames('row ascribe-detail-property', className)}>
<div className="row-same-height">
<div className={labelClassName}>
{label} {separator}
</div>
<div
className={valueClassName}
style={styles}>
<div className={classNames(valueClassName, {'add-overflow-ellipsis': ellipsis})}>
{children || value}
</div>
</div>

View File

@ -108,6 +108,12 @@ hr {
color: $ascribe-dark-blue;
}
.add-overflow-ellipsis {
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
.ascribe-subheader {
padding-bottom: 10px;
margin-top: -10px;