-
Notifications
You must be signed in to change notification settings - Fork 8
Style start/end node components #202
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from 6 commits
a007350
87b0d33
113b377
b372714
8a4c8a3
34493d4
28d52c7
e4bb37b
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -402,6 +402,64 @@ | |
| } | ||
|
|
||
| /* end validation errors */ | ||
|
|
||
| .dec-start-end-node { | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. You need to scope these styles under dec-root (you have done for dark mode) |
||
| position: relative; | ||
| display: flex; | ||
| justify-content: center; | ||
| align-items: center; | ||
|
kumaradityaraj marked this conversation as resolved.
Outdated
|
||
| } | ||
|
|
||
| .dec-start-node, | ||
| .dec-end-node { | ||
|
kumaradityaraj marked this conversation as resolved.
Outdated
|
||
| width: 72px; | ||
| height: 72px; | ||
| border-radius: 50%; | ||
| display: flex; | ||
| justify-content: center; | ||
| align-items: center; | ||
| position: relative; | ||
| background: var(--color-background, white); | ||
| } | ||
|
kumaradityaraj marked this conversation as resolved.
Outdated
|
||
|
|
||
| .dec-start-node { | ||
|
kumaradityaraj marked this conversation as resolved.
Outdated
|
||
| border: 1px solid #aea6a6; | ||
| background-color: #f2f2f2; | ||
| } | ||
|
|
||
| .dec-end-node { | ||
|
kumaradityaraj marked this conversation as resolved.
Outdated
|
||
| border: 1px solid #aea6a6; | ||
| background-color: #e7e3e3; | ||
| } | ||
|
|
||
| .dec-end-node-inner { | ||
|
kumaradityaraj marked this conversation as resolved.
Outdated
|
||
| position: absolute; | ||
| inset: 6px; | ||
| border-radius: 50%; | ||
| border: 1px solid #aea6a6; | ||
| background-color: #e7e3e3; | ||
| pointer-events: none; | ||
| } | ||
|
|
||
| .dec-start-end-node.selected .dec-start-node { | ||
|
kumaradityaraj marked this conversation as resolved.
Outdated
|
||
| box-shadow: 0 0 0 4px rgba(209, 204, 204, 0.3); | ||
| } | ||
|
|
||
| .dec-start-end-node.selected .dec-end-node { | ||
|
kumaradityaraj marked this conversation as resolved.
Outdated
|
||
| box-shadow: 0 0 0 4px rgba(209, 204, 204, 0.3); | ||
| } | ||
|
|
||
| .dec-start-node:hover, | ||
| .dec-end-node:hover { | ||
|
kumaradityaraj marked this conversation as resolved.
Outdated
|
||
| box-shadow: 0 0 0 4px rgba(209, 204, 204, 0.3); | ||
| } | ||
|
kumaradityaraj marked this conversation as resolved.
Outdated
|
||
|
|
||
| .dec-root.dark .dec-start-node, | ||
| .dec-root.dark .dec-end-node, | ||
| .dec-root.dark .dec-end-node-inner { | ||
| @apply dec:border-slate-600 | ||
| dec:bg-slate-800; | ||
|
kumaradityaraj marked this conversation as resolved.
Outdated
|
||
| } | ||
| } | ||
|
|
||
| /* custom edges */ | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -182,26 +182,18 @@ function TerminalNodeContent({ id, type }: { id: string; type: TerminalNodeType | |
| ); | ||
| } | ||
|
|
||
| // TODO: These props are just a placeholder | ||
| interface PlaceholderProps { | ||
| id: string; | ||
| data: BaseNodeData; | ||
| selected: boolean; | ||
| type: string; | ||
| } | ||
|
|
||
| // TODO: This content is just a placeholder | ||
| function PlaceholderContent({ id, data, selected, type }: PlaceholderProps) { | ||
| function StartEndNode({ id, data, selected, type }: NodeContentProps) { | ||
|
kumaradityaraj marked this conversation as resolved.
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. doesnt look like data prop is used? if not please remove |
||
| const isStart = type === GraphNodeType.Start; | ||
| return ( | ||
| <div | ||
| className={`custom-node-container ${selected ? "selected" : ""}`} | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. can you also remove the css styles for the placeholder component |
||
| className={`dec-start-end-node ${selected ? "selected" : ""}`} | ||
| data-testid={`${type}-node-${id}`} | ||
| > | ||
| <RF.Handle type="target" position={RF.Position.Top} /> | ||
| <div className="node-label-container" data-testid={`${type}-label-${id}`}> | ||
| {`${type}\n${data.label}`} | ||
| {!isStart && <RF.Handle type="target" position={RF.Position.Top} />} | ||
| <div className={isStart ? "dec-start-node" : "dec-end-node"}> | ||
| {!isStart && <div className="dec-end-node-inner" />} | ||
| </div> | ||
| <RF.Handle type="source" position={RF.Position.Bottom} /> | ||
| {isStart && <RF.Handle type="source" position={RF.Position.Bottom} />} | ||
|
kumaradityaraj marked this conversation as resolved.
|
||
| </div> | ||
|
kumaradityaraj marked this conversation as resolved.
kumaradityaraj marked this conversation as resolved.
|
||
| ); | ||
| } | ||
|
|
@@ -210,14 +202,14 @@ function PlaceholderContent({ id, data, selected, type }: PlaceholderProps) { | |
| export type StartNodeType = RF.Node<BaseNodeData, typeof GraphNodeType.Start>; | ||
| export function StartNode({ id, data, selected, type }: RF.NodeProps<StartNodeType>) { | ||
| // TODO: This component is just a placeholder | ||
|
kumaradityaraj marked this conversation as resolved.
kumaradityaraj marked this conversation as resolved.
|
||
| return <PlaceholderContent id={id} data={data} selected={selected} type={type} />; | ||
| return <StartEndNode id={id} data={data} selected={selected} type={type} />; | ||
|
Comment on lines
204
to
+205
|
||
| } | ||
|
kumaradityaraj marked this conversation as resolved.
|
||
|
|
||
| /* end node */ | ||
| export type EndNodeType = RF.Node<BaseNodeData, typeof GraphNodeType.End>; | ||
| export function EndNode({ id, data, selected, type }: RF.NodeProps<EndNodeType>) { | ||
| // TODO: This component is just a placeholder | ||
|
kumaradityaraj marked this conversation as resolved.
kumaradityaraj marked this conversation as resolved.
|
||
| return <PlaceholderContent id={id} data={data} selected={selected} type={type} />; | ||
| return <StartEndNode id={id} data={data} selected={selected} type={type} />; | ||
|
Comment on lines
211
to
+212
|
||
| } | ||
|
|
||
| /* entry node */ | ||
|
|
||
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Uh oh!
There was an error while loading. Please reload this page.