2016-03-17 11:31:11 +05:30
|
|
|
import React, { Component, PropTypes } from 'react';
|
|
|
|
|
2016-04-17 15:05:04 +05:30
|
|
|
import { Link } from 'react-router';
|
|
|
|
|
2016-03-17 11:31:11 +05:30
|
|
|
import styles from './profile.scss';
|
|
|
|
|
|
|
|
export default class ProfileField extends Component {
|
|
|
|
static displayName = 'ProfileField';
|
|
|
|
static propTypes = {
|
2016-03-20 14:00:58 +05:30
|
|
|
label: React.PropTypes.oneOfType([PropTypes.string, PropTypes.element]).isRequired,
|
2016-04-17 15:05:04 +05:30
|
|
|
link: PropTypes.string,
|
2016-03-17 11:31:11 +05:30
|
|
|
value: React.PropTypes.oneOfType([PropTypes.string, PropTypes.element]).isRequired,
|
|
|
|
warningMessage: React.PropTypes.oneOfType([PropTypes.string, PropTypes.element]),
|
|
|
|
readonly: PropTypes.bool
|
|
|
|
};
|
|
|
|
|
|
|
|
render() {
|
2016-04-17 15:05:04 +05:30
|
|
|
const {label, value, warningMessage, readonly, link = '#'} = this.props;
|
2016-03-17 11:31:11 +05:30
|
|
|
|
|
|
|
return (
|
|
|
|
<div className={styles.paramItem}>
|
|
|
|
<div className={styles.paramRow}>
|
|
|
|
<div className={styles.paramName}>{label}:</div>
|
|
|
|
<div className={styles.paramValue}>{value}</div>
|
|
|
|
|
|
|
|
{readonly ? '' : (
|
|
|
|
<div className={styles.paramAction}>
|
2016-04-17 15:05:04 +05:30
|
|
|
<Link to={link}>
|
2016-03-17 11:31:11 +05:30
|
|
|
<span className={styles.paramEditIcon} />
|
2016-04-17 15:05:04 +05:30
|
|
|
</Link>
|
2016-03-17 11:31:11 +05:30
|
|
|
</div>
|
|
|
|
)}
|
|
|
|
</div>
|
|
|
|
|
|
|
|
{warningMessage ? (
|
|
|
|
<div className={styles.paramMessage}>
|
|
|
|
{warningMessage}
|
|
|
|
</div>
|
|
|
|
) : ''}
|
|
|
|
</div>
|
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|