import React from 'react';
import PropTypes from 'prop-types';
class Feature extends React.Component {
render() {
return (
<div className="box box-solid">
<div className="box-body">
<h4 className="feature-header">
{this.props.headline}
</h4>
<div className="media">
{this.props.img ? (
<div className="media-left">
<a href={this.props.imgLink} onClick={this.props.imgOnClick}>
<img
src={this.props.img}
alt={this.props.imgAlt}
className="media-object feature-img"
/>
</a>
</div>
) : ''}
<div className="media-body">
<div className="clearfix">
{this.props.cta ? (
<p className="pull-right">
<a
href={this.props.ctaLink}
onClick={this.props.ctaOnClick}
className={`btn btn-sm ${this.props.ctaTheme}`}
>
{this.props.cta}
</a>
</p>
) : ''}
{this.props.content}
{this.props.children}
</div>
</div>
</div>
</div>
</div>
);
}
}
Feature.propTypes = {
headline: PropTypes.oneOfType([
PropTypes.string,
PropTypes.element
]),
img: PropTypes.string,
imgLink: PropTypes.string,
imgOnClick: PropTypes.func,
imgAlt: PropTypes.string,
cta: PropTypes.string,
ctaLink: PropTypes.string,
ctaOnClick: PropTypes.func,
ctaTheme: PropTypes.string,
content: PropTypes.oneOfType([
PropTypes.string,
PropTypes.element
])
};
Feature.defaultProps = {
headline: '',
img: '',
imgOnClick: () => {},
imgAlt: '',
ctaOnClick: () => {},
ctaTheme: 'btn-success',
content: ''
};
export default Feature;
|