diff --git a/site/components/Link.js b/site/components/Link.js new file mode 100644 index 0000000..b1d97df --- /dev/null +++ b/site/components/Link.js @@ -0,0 +1,31 @@ +import Link from "next/link"; +import ReactPlayer from "react-player"; + +const videoLinks = [ + "youtube.com", + "dailymotion.com", + "vimeo.com", + "soundcloud.com", + "facebook.com/watch", + "twitch.com", +]; + +export const Paragraph = (props) => { + if ( + typeof props.children == "object" && + props.children.props && + props.children.props.href && + videoLinks.some((str) => props.children.props.href.includes(str)) + ) + return ( +
+ +
+ ); + return

; +}; diff --git a/site/components/MDX.js b/site/components/MDX.js index 405122c..154f87f 100644 --- a/site/components/MDX.js +++ b/site/components/MDX.js @@ -1,8 +1,9 @@ import Head from 'next/head' -import Link from 'next/link' +import { Paragraph } from './Link' const components = { Head, + p: Paragraph } export default function MdxPage({ children }) {