Refactor DBDiagram class component to functional (#4228)

This commit is contained in:
pbkompasz
2022-10-08 16:50:08 +03:00
committed by GitHub
parent 013a134084
commit c8f990018c
7 changed files with 68 additions and 70 deletions

View File

@@ -2,19 +2,17 @@ import * as React from "react";
import Frame from "../components/Frame";
import { EmbedProps as Props } from ".";
export default class Descript extends React.Component<Props> {
static ENABLED = [new RegExp("https?://share\\.descript\\.com/view/(\\w+)$")];
render() {
const { matches } = this.props.attrs;
const shareId = matches[1];
return (
<Frame
{...this.props}
src={`https://share.descript.com/embed/${shareId}`}
title={`Descript (${shareId})`}
width="400px"
/>
);
}
export default function Descript(props: Props) {
const { matches } = props.attrs;
const shareId = matches[1];
return (
<Frame
{...props}
src={`https://share.descript.com/embed/${shareId}`}
title={`Descript (${shareId})`}
width="400px"
/>
);
}
Descript.ENABLED = [new RegExp("https?://share\\.descript\\.com/view/(\\w+)$")];