mirror of
https://github.com/wassname/talk.git
synced 2026-07-15 11:26:58 +08:00
14 lines
267 B
JavaScript
14 lines
267 B
JavaScript
import React from 'react';
|
|
import Linkify from 'react-linkify';
|
|
const linkify = new Linkify();
|
|
|
|
export default ({text, children}) => {
|
|
const hasLinks = !!linkify.getMatches(text);
|
|
|
|
if (!hasLinks) {
|
|
return null;
|
|
}
|
|
|
|
return React.Children.only(children);
|
|
};
|