import React from 'react'; import {RegExpUtils} from 'nylas-exports'; const FormErrorMessage = (props) => { const {message, empty} = props; if (!message) { return
{empty}
; } const result = RegExpUtils.urlRegex({matchEntireString: false}).exec(message); if (result) { const link = result[0]; return (
{message.substr(0, result.index)} {link} {message.substr(result.index + link.length)}
); } return (
{message}
); } FormErrorMessage.propTypes = { empty: React.PropTypes.string, message: React.PropTypes.string, }; export default FormErrorMessage;