forked from outline/outline
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: Add ClickUp Embed Service (outline#1465)
* Add Clickup Embed Service * Transparency Icon Co-authored-by: Tom Moor <[email protected]>
- Loading branch information
Showing
4 changed files
with
47 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
// @flow | ||
import * as React from "react"; | ||
import Frame from "./components/Frame"; | ||
|
||
const URL_REGEX = new RegExp( | ||
"^https?://share.clickup.com/[a-z]/[a-z]/(.*)/(.*)$" | ||
); | ||
|
||
type Props = {| | ||
attrs: {| | ||
href: string, | ||
matches: string[], | ||
|}, | ||
|}; | ||
|
||
export default class ClickUp extends React.Component<Props> { | ||
static ENABLED = [URL_REGEX]; | ||
|
||
render() { | ||
return <Frame src={this.props.attrs.href} title="ClickUp Embed" />; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
/* eslint-disable flowtype/require-valid-file-annotation */ | ||
import ClickUp from "./ClickUp"; | ||
|
||
describe("ClickUp", () => { | ||
const match = ClickUp.ENABLED[0]; | ||
test("to be enabled on share link", () => { | ||
expect( | ||
"https://share.clickup.com/b/h/6-9310960-2/c9d837d74182317".match(match) | ||
).toBeTruthy(); | ||
}); | ||
|
||
test("to not be enabled elsewhere", () => { | ||
expect("https://share.clickup.com".match(match)).toBe(null); | ||
expect("https://clickup.com/".match(match)).toBe(null); | ||
expect("https://clickup.com/features".match(match)).toBe(null); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.