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 { const {
children, children,
className, className,
ellipsis,
label, label,
labelClassName, labelClassName,
separator, separator,
valueClassName, valueClassName,
value } = this.props; value } = this.props;
const styles = this.props.ellipsis ? {
whiteSpace: 'nowrap',
overflow: 'hidden',
textOverflow: 'ellipsis'
} : null;
return ( return (
<div className={classNames('row ascribe-detail-property', className)}> <div className={classNames('row ascribe-detail-property', className)}>
<div className="row-same-height"> <div className="row-same-height">
<div className={labelClassName}> <div className={labelClassName}>
{label} {separator} {label} {separator}
</div> </div>
<div <div className={classNames(valueClassName, {'add-overflow-ellipsis': ellipsis})}>
className={valueClassName}
style={styles}>
{children || value} {children || value}
</div> </div>
</div> </div>

View File

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