2015-07-08 22:54:07 +02:00
|
|
|
'use strict';
|
|
|
|
|
|
|
|
import React from 'react';
|
2015-12-23 09:39:02 +01:00
|
|
|
import classNames from 'classnames';
|
2015-07-08 22:54:07 +02:00
|
|
|
|
2015-11-03 10:39:01 +01:00
|
|
|
|
2015-12-23 09:39:02 +01:00
|
|
|
const DetailProperty = React.createClass({
|
2015-07-08 22:54:07 +02:00
|
|
|
propTypes: {
|
|
|
|
label: React.PropTypes.string,
|
|
|
|
value: React.PropTypes.oneOfType([
|
2015-10-28 18:37:09 +01:00
|
|
|
React.PropTypes.number,
|
2015-07-08 22:54:07 +02:00
|
|
|
React.PropTypes.string,
|
|
|
|
React.PropTypes.element
|
|
|
|
]),
|
|
|
|
separator: React.PropTypes.string,
|
2015-12-23 09:39:02 +01:00
|
|
|
className: React.PropTypes.string,
|
2015-07-08 22:54:07 +02:00
|
|
|
labelClassName: React.PropTypes.string,
|
2015-07-27 18:19:55 +02:00
|
|
|
valueClassName: React.PropTypes.string,
|
2015-10-28 18:37:09 +01:00
|
|
|
ellipsis: React.PropTypes.bool,
|
|
|
|
children: React.PropTypes.oneOfType([
|
|
|
|
React.PropTypes.arrayOf(React.PropTypes.element),
|
|
|
|
React.PropTypes.element
|
|
|
|
])
|
2015-07-08 22:54:07 +02:00
|
|
|
},
|
|
|
|
|
|
|
|
getDefaultProps() {
|
|
|
|
return {
|
2015-08-12 16:47:16 +02:00
|
|
|
separator: '',
|
2015-11-03 10:39:01 +01:00
|
|
|
labelClassName: 'col-xs-3 col-sm-3 col-md-2 col-lg-2 col-xs-height ascribe-detail-property-label',
|
2015-08-11 17:12:12 +02:00
|
|
|
valueClassName: 'col-xs-9 col-sm-9 col-md-10 col-lg-10 col-xs-height col-bottom ascribe-detail-property-value'
|
2015-07-08 22:54:07 +02:00
|
|
|
};
|
|
|
|
},
|
|
|
|
|
|
|
|
render() {
|
2015-12-23 09:39:02 +01:00
|
|
|
const {
|
|
|
|
children,
|
|
|
|
className,
|
2015-12-23 10:20:56 +01:00
|
|
|
ellipsis,
|
2015-12-23 09:39:02 +01:00
|
|
|
label,
|
|
|
|
labelClassName,
|
|
|
|
separator,
|
|
|
|
valueClassName,
|
|
|
|
value } = this.props;
|
2015-07-30 11:48:47 +02:00
|
|
|
|
2015-07-08 22:54:07 +02:00
|
|
|
return (
|
2015-12-23 09:39:02 +01:00
|
|
|
<div className={classNames('row ascribe-detail-property', className)}>
|
2015-07-08 22:54:07 +02:00
|
|
|
<div className="row-same-height">
|
2015-11-03 10:39:01 +01:00
|
|
|
<div className={labelClassName}>
|
|
|
|
{label} {separator}
|
2015-07-08 22:54:07 +02:00
|
|
|
</div>
|
2015-12-23 10:20:56 +01:00
|
|
|
<div className={classNames(valueClassName, {'add-overflow-ellipsis': ellipsis})}>
|
2015-11-03 10:39:01 +01:00
|
|
|
{children || value}
|
2015-07-08 22:54:07 +02:00
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
);
|
|
|
|
}
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
export default DetailProperty;
|