2015-07-08 22:54:07 +02:00
|
|
|
'use strict';
|
|
|
|
|
|
|
|
import React from 'react';
|
|
|
|
|
|
|
|
let DetailProperty = React.createClass({
|
|
|
|
propTypes: {
|
|
|
|
label: React.PropTypes.string,
|
|
|
|
value: React.PropTypes.oneOfType([
|
|
|
|
React.PropTypes.string,
|
|
|
|
React.PropTypes.element
|
|
|
|
]),
|
|
|
|
separator: React.PropTypes.string,
|
|
|
|
labelClassName: React.PropTypes.string,
|
2015-07-27 18:19:55 +02:00
|
|
|
valueClassName: React.PropTypes.string,
|
|
|
|
breakWord: React.PropTypes.bool
|
2015-07-08 22:54:07 +02:00
|
|
|
},
|
|
|
|
|
|
|
|
getDefaultProps() {
|
|
|
|
return {
|
|
|
|
separator: ':',
|
2015-07-27 18:19:55 +02:00
|
|
|
labelClassName: 'col-xs-3 col-sm-3 col-md-2 col-lg-2',
|
|
|
|
valueClassName: 'col-xs-9 col-sm-9 col-md-10 col-lg-10'
|
2015-07-08 22:54:07 +02:00
|
|
|
};
|
|
|
|
},
|
|
|
|
|
|
|
|
render() {
|
|
|
|
let value = this.props.value;
|
2015-07-27 18:19:55 +02:00
|
|
|
|
2015-07-08 22:54:07 +02:00
|
|
|
if (this.props.children){
|
|
|
|
value = (
|
|
|
|
<div className="row-same-height">
|
|
|
|
<div className="col-xs-6 col-xs-height col-bottom no-padding">
|
|
|
|
{ this.props.value }
|
|
|
|
</div>
|
2015-07-27 18:24:21 +02:00
|
|
|
<div className="col-xs-6 col-xs-height">
|
2015-07-08 22:54:07 +02:00
|
|
|
{ this.props.children }
|
|
|
|
</div>
|
|
|
|
</div>);
|
|
|
|
}
|
|
|
|
return (
|
|
|
|
<div className="row ascribe-detail-property">
|
|
|
|
<div className="row-same-height">
|
2015-07-15 12:23:02 +02:00
|
|
|
<div className={this.props.labelClassName + ' col-xs-height col-bottom ascribe-detail-property-label'}>
|
|
|
|
{ this.props.label + this.props.separator}
|
2015-07-08 22:54:07 +02:00
|
|
|
</div>
|
2015-07-27 18:24:21 +02:00
|
|
|
<div className={this.props.valueClassName + ' col-xs-height col-bottom ascribe-detail-property-value'}>
|
2015-07-08 22:54:07 +02:00
|
|
|
{value}
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
);
|
|
|
|
}
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
export default DetailProperty;
|