Refactor components

This commit is contained in:
Amine Ben hammou
2019-05-07 16:34:42 +00:00
committed by M. Shull
parent ebe22aa98e
commit 7ddffb4dd5

View File

@@ -7,7 +7,11 @@ import ReactStringReplace from 'react-string-replace';
const userHostDomain = window.location.hostname.replace('www.', '');
const suggestedEmailAddress = `contact@${userHostDomain}`;
const OldInstallationWarning = ({ emailAddress }) => (
const SenderEmailAddressWarning = ({ emailAddress, mssActive }) => {
if (mssActive) return null
const emailAddressDomain = emailAddress.split('@').pop().toLowerCase();
if (window.mailpoet_free_domains.indexOf(emailAddressDomain) > -1) {
return (
<React.Fragment>
<p
className="sender_email_address_warning"
@@ -37,16 +41,6 @@ const OldInstallationWarning = ({ emailAddress }) => (
</p>
</React.Fragment>
);
OldInstallationWarning.propTypes = {
emailAddress: PropTypes.string.isRequired,
};
const SenderEmailAddressWarning = ({ emailAddress, mssActive }) => {
if (mssActive) return null
const emailAddressDomain = emailAddress.split('@').pop().toLowerCase();
if (window.mailpoet_free_domains.indexOf(emailAddressDomain) > -1) {
return <OldInstallationWarning emailAddress={emailAddress} />;
}
return null;
};