-
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 all 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,61 @@ | |
| } | ||
|
|
||
| /* end validation errors */ | ||
|
|
||
| .dec-start-end-node { | ||
| position: relative; | ||
| display: flex; | ||
| justify-content: center; | ||
| align-items: center; | ||
| } | ||
|
|
||
| .dec-start-node, | ||
| .dec-end-node { | ||
| width: 72px; | ||
| height: 72px; | ||
| border-radius: 50%; | ||
| display: flex; | ||
| justify-content: center; | ||
| align-items: center; | ||
| position: relative; | ||
|
|
||
| @apply dec:border | ||
| dec:border-slate-300 | ||
|
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. its a bit too light on light mode, can you try border colour slate-400 |
||
| dec:bg-slate-100 | ||
| dec:text-slate-600; | ||
| } | ||
|
|
||
| .dec-end-node-inner { | ||
| position: absolute; | ||
| inset: 6px; | ||
| border-radius: 50%; | ||
| pointer-events: none; | ||
|
|
||
| @apply dec:border | ||
| dec:border-slate-300 | ||
| dec:bg-slate-100; | ||
| } | ||
|
|
||
| .dec-start-end-node.selected .dec-start-node, | ||
| .dec-start-end-node.selected .dec-end-node, | ||
| .dec-start-node:hover, | ||
| .dec-end-node:hover { | ||
| box-shadow: 0 0 0 4px rgba(209, 204, 204, 0.3); | ||
| } | ||
|
|
||
| .dec-root.dark .dec-start-node, | ||
| .dec-root.dark .dec-end-node { | ||
| @apply dec:border | ||
| dec:border-slate-600 | ||
| dec:bg-slate-800 | ||
| dec:text-slate-300; | ||
| } | ||
|
|
||
| .dec-root.dark .dec-end-node-inner { | ||
| @apply dec:border | ||
| dec:border-slate-600 | ||
| dec:bg-slate-800; | ||
| } | ||
| } | ||
|
|
||
| /* 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) { | ||
|
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.
|
||
| ); | ||
| } | ||
|
|
@@ -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 | ||
| 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
|
||
| } | ||
|
|
||
| /* 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 | ||
| 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 */ | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The 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)