accounts-frontend/src/components/profile/ProfileField.jsx

41 lines
1.4 KiB
React
Raw Normal View History

import React, { Component, PropTypes } from 'react';
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,
value: React.PropTypes.oneOfType([PropTypes.string, PropTypes.element]).isRequired,
warningMessage: React.PropTypes.oneOfType([PropTypes.string, PropTypes.element]),
readonly: PropTypes.bool
};
render() {
const {label, value, warningMessage, readonly} = this.props;
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}>
<a href="#">
<span className={styles.paramEditIcon} />
</a>
</div>
)}
</div>
{warningMessage ? (
<div className={styles.paramMessage}>
{warningMessage}
</div>
) : ''}
</div>
);
}
}