forked from outline/outline
-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathTrello.js
39 lines (33 loc) · 817 Bytes
/
Trello.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
// @flow
import * as React from 'react';
import Frame from './components/Frame';
const URL_REGEX = /^https:\/\/trello.com\/(c|b)\/(.*)$/;
type Props = {
url: string,
matches: string[],
};
export default class Trello extends React.Component<Props> {
static ENABLED = [URL_REGEX];
render() {
const { matches } = this.props;
const objectId = matches[2];
if (matches[1] === 'c') {
return (
<Frame
width="316px"
height="158px"
src={`https://trello.com/embed/card?id=${objectId}`}
title={`Trello Card (${objectId})`}
/>
);
}
return (
<Frame
width="248px"
height="185px"
src={`https://trello.com/embed/board?id=${objectId}`}
title={`Trello Board (${objectId})`}
/>
);
}
}