bigbuffet-rw/app/soapbox/features/ui/components/explanation_box.js

28 lines
747 B
JavaScript
Raw Normal View History

2020-03-27 13:59:38 -07:00
import React from 'react';
2020-04-14 14:37:17 -07:00
import PropTypes from 'prop-types';
2020-03-27 13:59:38 -07:00
export default
class ExplanationBox extends React.PureComponent {
2020-04-14 14:37:17 -07:00
static propTypes = {
title: PropTypes.oneOfType([PropTypes.string, PropTypes.element]),
explanation: PropTypes.oneOfType([PropTypes.string, PropTypes.element]),
dismissable: PropTypes.bool,
};
2020-03-27 13:59:38 -07:00
render() {
const { title, explanation, dismissable } = this.props;
return (
<div className='explanation-box'>
{title && <div className='explanation-box__title'>{title}</div>}
<div className='explanation-box__explanation'>
{explanation}
{dismissable && <span className='explanation-box__dismiss'>Dismiss</span>}
</div>
</div>
2020-04-14 11:44:40 -07:00
);
2020-03-27 13:59:38 -07:00
}
2020-04-14 11:44:40 -07:00
2020-03-27 13:59:38 -07:00
}