import React from 'react';
import PropTypes from 'prop-types';
class CalloutAlert extends React.Component {
render() {
const classList = this.props.callout ? `callout callout-${this.props.theme}` : `alert alert-${this.props.theme} text-left${this.props.dismissible ? ' alert-dismissible' : ''}`;
return (
<div className={classList}>
{!this.props.callout && this.props.dismissible ? <button type="button" className="close" data-dismiss="alert" aria-hidden="true">×</button> : ''}
<h4>
{this.props.icon ? <i className={`fa ${this.props.icon}`} /> : ''}
{this.props.icon && this.props.header ? ' ' : ''}
{this.props.header}
</h4>
<p>{this.props.content}</p>
</div>
);
}
}
CalloutAlert.propTypes = {
theme: PropTypes.string,
icon: PropTypes.string,
header: PropTypes.string,
content: PropTypes.string,
callout: PropTypes.bool,
dismissible: PropTypes.bool
};
CalloutAlert.defaultProps = {
theme: 'success',
icon: '',
header: '',
content: '',
callout: false,
dismissible: false
};
export default CalloutAlert;
|