import { FileExtensionRegex } from "Const";
import { ProxyImg } from "Element/ProxyImg";
export default function MediaLink({ link }: { link: string }) {
const url = new URL(link);
const extension = FileExtensionRegex.test(url.pathname.toLowerCase()) && RegExp.$1;
switch (extension) {
case "gif":
case "jpg":
case "jpeg":
case "jfif":
case "png":
case "bmp":
case "webp": {
return ;
}
case "wav":
case "mp3":
case "ogg": {
return ;
}
case "mp4":
case "mov":
case "mkv":
case "avi":
case "m4v":
case "webm": {
return ;
}
default:
return (
e.stopPropagation()}
target="_blank"
rel="noreferrer"
className="ext">
{url.toString()}
);
}
}