Functional Component Refactor: Google Docs, Drive, Sheets, & Slides (#4259)

This commit is contained in:
mastqe
2022-10-15 10:00:59 -04:00
committed by GitHub
parent 136d98792b
commit 4dc336eeab
4 changed files with 97 additions and 101 deletions

View File

@@ -3,27 +3,27 @@ import Frame from "../components/Frame";
import Image from "../components/Image";
import { EmbedProps as Props } from ".";
const URL_REGEX = new RegExp("^https?://drive\\.google\\.com/file/d/(.*)$");
export default class GoogleDrive extends React.Component<Props> {
static ENABLED = [URL_REGEX];
render() {
return (
<Frame
src={this.props.attrs.href.replace("/view", "/preview")}
icon={
<Image
src="/images/google-drive.png"
alt="Google Drive Icon"
width={16}
height={16}
/>
}
title="Google Drive"
canonicalUrl={this.props.attrs.href}
border
/>
);
}
function GoogleDrive(props: Props) {
return (
<Frame
src={props.attrs.href.replace("/view", "/preview")}
icon={
<Image
src="/images/google-drive.png"
alt="Google Drive Icon"
width={16}
height={16}
/>
}
title="Google Drive"
canonicalUrl={props.attrs.href}
border
/>
);
}
GoogleDrive.ENABLED = [
new RegExp("^https?://drive\\.google\\.com/file/d/(.*)$"),
];
export default GoogleDrive;