import React from 'react';
const youtubeRegex1 = /https:\/\/www\.youtube\.com\/watch?.*v=([_a-zA-Z0-9]+).*/i;
const youtubeRegex2 = /https:\/\/youtu.be\/([_a-zA-Z0-9]+)/i;
interface YouTubeProps {
videoId: string;
}
function YouTube({ videoId }: YouTubeProps) {
return (
);
}
export default function renderYouTube(text: string) {
let match = text.match(youtubeRegex1) || text.match(youtubeRegex2);
if (!match) return null;
return ;
}