-
Notifications
You must be signed in to change notification settings - Fork 478
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add HTTP Trigger node component
- Loading branch information
1 parent
906c29c
commit 8f385be
Showing
5 changed files
with
99 additions
and
5 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,23 @@ | ||
import { SVGProps } from "react"; | ||
const SvgComponent = (props: SVGProps<SVGSVGElement>) => ( | ||
<svg | ||
xmlns="http://www.w3.org/2000/svg" | ||
width={24} | ||
height={24} | ||
fill="none" | ||
{...props} | ||
> | ||
<g clipPath="url(#a)"> | ||
<path | ||
fill="currentColor" | ||
d="M4.5 11h-2V9H1v6h1.5v-2.5h2V15H6V9H4.5v2Zm2.5-.5h1.5V15H10v-4.5h1.5V9H7v1.5Zm5.5 0H14V15h1.5v-4.5H17V9h-4.5v1.5Zm9-1.5H18v6h1.5v-2h2c.8 0 1.5-.7 1.5-1.5v-1c0-.8-.7-1.5-1.5-1.5Zm0 2.5h-2v-1h2v1Z" | ||
/> | ||
</g> | ||
<defs> | ||
<clipPath id="a"> | ||
<path fill="#fff" d="M0 0h24v24H0z" /> | ||
</clipPath> | ||
</defs> | ||
</svg> | ||
); | ||
export default SvgComponent; |
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
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,47 @@ | ||
import { Http } from "@src/assets/icons"; | ||
import { | ||
Node, | ||
NodeName, | ||
NodeParam, | ||
NodeParams, | ||
NodeToolbar, | ||
} from "@src/components/Workflow"; | ||
import { useCallback, useState } from "react"; | ||
|
||
export default function HttpTriggerNode() { | ||
const [name, setName] = useState("HTTP Trigger"); | ||
|
||
const [collapsed, setCollapsed] = useState(false); | ||
|
||
const handleToggleCollapse = useCallback(() => { | ||
setCollapsed((collapsed) => !collapsed); | ||
}, [setCollapsed]); | ||
|
||
return ( | ||
<Node> | ||
<NodeToolbar | ||
collapsed={collapsed} | ||
onToggleCollapse={handleToggleCollapse} | ||
> | ||
<Http /> | ||
<NodeName | ||
name={name} | ||
onNameChange={setName} | ||
tooltip="Triggered by an HTTP request" | ||
/> | ||
</NodeToolbar> | ||
<NodeParams open={!collapsed}> | ||
<NodeParam | ||
name="Method" | ||
tooltip="The HTTP method to listen for" | ||
htmlFor="method" | ||
/> | ||
<NodeParam | ||
name="Path" | ||
tooltip="The path to listen for" | ||
htmlFor="path" | ||
/> | ||
</NodeParams> | ||
</Node> | ||
); | ||
} |
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,8 @@ | ||
import HttpTriggerNode from "./HttpTriggerNode"; | ||
import Node from "./Node"; | ||
import NodeName from "./NodeName"; | ||
import NodeParam from "./NodeParam"; | ||
import NodeParams from "./NodeParams"; | ||
import NodeToolbar from "./NodeToolbar"; | ||
|
||
export { HttpTriggerNode, Node, NodeName, NodeParam, NodeParams, NodeToolbar }; |
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