const Linkify = memo((props: ILinkifyProps) => {
return (
<LinkItPhone>
<LinkItUrl>
<LinkItEmail>{props.children}</LinkItEmail>
</LinkItUrl>
</LinkItPhone>
);
});
Linkify.displayName = 'Linkify';
const phoneRegex = /\+?\(?\d{3}\)?[\s.-]?\d{3}[\s.-]?\d{4,6}/;
const phoneLinkComponent = (match: string, key: number) => (
<a href={'tel:' + match.replace(/\D/g, '')} key={key}>
{match}
</a>
);
const LinkItPhone = memo((props: { children: StrictReactNode }) => {
return (
<LinkIt component={phoneLinkComponent} regex={phoneRegex}>
{props.children}
</LinkIt>
);
});
LinkItPhone.displayName = 'LinkItPhone';
Is there reason you chose to not catch like
youtube.com? Or should we try to find a regex that gets it too? This component I'm using: