import React from 'react'; const URL_REGEX = /(https?:\/\/[^\s]+)/g; export function Linkify({ children }: { children: React.ReactNode }) { if (typeof children !== 'string') { return <>{children}; } const parts = children.split(URL_REGEX); return ( <> {parts.map((part, i) => { if (part.match(URL_REGEX)) { return ( e.stopPropagation()} > {part} ); } return {part}; })} ); }