Files
piratepoet/assets/js/src/common/print_boolean.jsx
2018-11-01 02:12:16 +02:00

28 lines
607 B
JavaScript

import PropTypes from 'prop-types';
import React from 'react';
import MailPoet from 'mailpoet';
const PrintBoolean = props => (
<span>
{(props.children === true && props.truthy) ||
(props.children === false && props.falsy) ||
(props.unknown)}
</span>
);
PrintBoolean.propTypes = {
truthy: PropTypes.string,
falsy: PropTypes.string,
unknown: PropTypes.string,
children: PropTypes.bool,
};
PrintBoolean.defaultProps = {
truthy: MailPoet.I18n.t('yes'),
falsy: MailPoet.I18n.t('no'),
unknown: MailPoet.I18n.t('unknown'),
children: null,
};
module.exports = PrintBoolean;