feat: Add Google DataStudio embed (#2293)

Co-authored-by: Tom Moor <tom.moor@gmail.com>
This commit is contained in:
Matheus Breguêz
2021-07-14 15:57:12 -03:00
committed by GitHub
parent 8e5a2b85c2
commit 06e16eef12
4 changed files with 66 additions and 0 deletions

View File

@@ -0,0 +1,39 @@
// @flow
import * as React from "react";
import Image from "components/Image";
import Frame from "./components/Frame";
const URL_REGEX = new RegExp(
"^https?://datastudio.google.com/(embed|u/0)/reporting/(.*)/page/(.*)(/edit)?$"
);
type Props = {|
attrs: {|
href: string,
matches: string[],
|},
|};
export default class GoogleDataStudio extends React.Component<Props> {
static ENABLED = [URL_REGEX];
render() {
return (
<Frame
{...this.props}
src={this.props.attrs.href.replace("u/0", "embed").replace("/edit", "")}
icon={
<Image
src="/images/google-datastudio.png"
alt="Google Data Studio Icon"
width={16}
height={16}
/>
}
canonicalUrl={this.props.attrs.href}
title="Google Data Studio"
border
/>
);
}
}