import React from 'react';
import PropTypes from 'prop-types';
class ProfileCard extends React.Component {
render() {
const coverPic = this.props.coverImg ? {
background: `url(${this.props.coverImg}) center`
} : {};
const alignmentType = this.props.imgAlignment === 'left' ? 'widget-user-2' : 'widget-user';
const footerPadding = this.props.imgAlignment === 'left' ? 'no-padding' : '';
return (
<div className={`col-md-${this.props.width}`}>
<div className={`box box-widget ${alignmentType}`}>
<div className={`widget-user-header ${this.props.theme}`} style={coverPic}>
{this.props.img ? (
<div className="widget-user-image">
<img className="img-circle" src={this.props.img} alt="User Avatar" />
</div>
) : ''}
<h3 className="widget-user-username">{this.props.name}</h3>
<h5 className="widget-user-desc">{this.props.description}</h5>
</div>
<div className={`box-footer ${footerPadding}`}>
{this.props.children}
</div>
</div>
</div>
);
}
}
ProfileCard.propTypes = {
width: PropTypes.oneOfType([
PropTypes.string,
PropTypes.number
]),
theme: PropTypes.string,
imgAlignment: PropTypes.string,
name: PropTypes.string,
description: PropTypes.string,
img: PropTypes.string,
coverImg: PropTypes.string,
date: PropTypes.string
};
ProfileCard.defaultProps = {
width: 3,
theme: 'bg-yellow',
imgAlignment: 'center',
name: '',
description: ''
};
export default ProfileCard;
|