import PropTypes from 'prop-types'; import React from 'react'; import { Link } from 'react-router-dom'; import styles from './profile.scss'; export default class ProfileField extends React.Component { static propTypes = { label: PropTypes.oneOfType([PropTypes.string, PropTypes.element]) .isRequired, link: PropTypes.string, onChange: PropTypes.func, value: PropTypes.oneOfType([PropTypes.string, PropTypes.element]) .isRequired, warningMessage: PropTypes.oneOfType([PropTypes.string, PropTypes.element]), }; render() { const { label, value, warningMessage, link, onChange } = this.props; let Action = null; if (link) { Action = props => ; } if (onChange) { Action = props => ; } return (
{label}
{value}
{Action ? ( ) : null}
{warningMessage ? (
{warningMessage}
) : ( '' )}
); } }