Added linkfy lib to handle messages links

This commit is contained in:
canove
2020-07-25 10:25:13 -03:00
parent 1550fefa41
commit a543dd31ae
4 changed files with 68 additions and 23 deletions

View File

@@ -0,0 +1,14 @@
import React from "react";
import Linkify from "react-linkify";
const componentDecorator = (href, text, key) => (
<a href={href} key={key} target="_blank" rel="noopener noreferrer">
{text}
</a>
);
const LinkifyWithTargetBlank = ({ children }) => {
return <Linkify componentDecorator={componentDecorator}>{children}</Linkify>;
};
export default LinkifyWithTargetBlank;