-
Notifications
You must be signed in to change notification settings - Fork 2.6k
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
Improve the design of workflow nodes #9810
Conversation
Devessier
commented
Jan 23, 2025
•
edited
Loading
edited
- Go over every node in the workflows and fix the styles to conform to Figma
- Create stories for every node type
const NODE_HANDLE_WIDTH_PX = 4; | ||
const NODE_HANDLE_HEIGHT_PX = NODE_HANDLE_WIDTH_PX; | ||
export const NODE_ICON_WIDTH = Number( | ||
THEME_COMMON.spacing(6).replace('px', ''), | ||
); | ||
export const NODE_ICON_LEFT_MARGIN = Number( | ||
THEME_COMMON.spacing(2).replace('px', ''), | ||
); | ||
export const NODE_BORDER_WIDTH = 1; |
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.
I don't really know where to put these constants.
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.
why not in a separated file in workflow-diagram/constants/
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.
PR Summary
This PR enhances workflow node design with improved styling consistency and component organization.
- Standardized icon sizes across nodes using
theme.icon.size.md
instead of hardcoded values in/packages/twenty-front/src/modules/workflow/workflow-diagram/components/WorkflowDiagramStepNodeBase.tsx
- Added constants for node dimensions and spacing (NODE_HANDLE_WIDTH_PX, NODE_ICON_WIDTH) for better maintainability
- Improved visual hierarchy with refined font sizes (9px for node type, 13px for label) and box shadow styling
- Created new
WorkflowDiagramStepNodeEditableContent
component for better separation of concerns with delete functionality - Added comprehensive Storybook stories showcasing different workflow node states and configurations
9 file(s) reviewed, 6 comment(s)
Edit PR Review Bot Settings | Greptile
transform: translateX(-50%); | ||
position: relative; | ||
left: ${NODE_ICON_WIDTH + NODE_ICON_LEFT_MARGIN + NODE_BORDER_WIDTH}px; |
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.
style: Using both transform: translateX(-50%) and explicit left positioning could lead to unexpected positioning behavior. Consider using one or the other.
const StyledTargetHandle = styled(StyledSourceHandle)` | ||
left: ${NODE_ICON_WIDTH + NODE_ICON_LEFT_MARGIN + NODE_BORDER_WIDTH}px; | ||
visibility: hidden; |
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.
style: StyledTargetHandle duplicates the left position from StyledSourceHandle unnecessarily since it inherits from it
<FloatingIconButton | ||
size="medium" | ||
Icon={IconTrash} | ||
onClick={onDelete} | ||
/> |
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.
style: Missing aria-label for accessibility on delete button
<FloatingIconButton | ||
size="medium" | ||
Icon={IconTrash} | ||
onClick={onDelete} |
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.
style: Consider adding stopPropagation() to prevent node selection from being triggered when deleting
import { Meta, StoryObj } from '@storybook/react'; | ||
import { ComponentDecorator } from 'twenty-ui'; | ||
|
||
import { ReactFlowProvider } from '@xyflow/react'; |
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.
logic: missing import for @xyflow/react/dist/style.css which is required for ReactFlow to render correctly
ComponentDecorator, | ||
(Story) => ( | ||
<ReactFlowProvider> | ||
<Story /> | ||
</ReactFlowProvider> | ||
), |
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.
style: duplicate ReactFlowProvider decorator from Default story could be extracted to meta.decorators to avoid repetition
@@ -21,7 +31,7 @@ const StyledStepNodeType = styled.div` | |||
${({ theme }) => theme.border.radius.sm} 0 0; | |||
|
|||
color: ${({ theme }) => theme.font.color.light}; | |||
font-size: ${({ theme }) => theme.font.size.md}; | |||
font-size: 9px; |
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.
Thomas wants these pixel-perfect values. We can replace these hard-coded values with tokens from the design system later.
@@ -61,7 +70,7 @@ const StyledStepNodeInnerContainer = styled.div<{ variant?: Variant }>` | |||
const StyledStepNodeLabel = styled.div<{ variant?: Variant }>` | |||
align-items: center; | |||
display: flex; | |||
font-size: ${({ theme }) => theme.font.size.lg}; | |||
font-size: 13px; |
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.
Idem about pixel-perfect values.
const NODE_HANDLE_WIDTH_PX = 4; | ||
const NODE_HANDLE_HEIGHT_PX = NODE_HANDLE_WIDTH_PX; | ||
export const NODE_ICON_WIDTH = Number( | ||
THEME_COMMON.spacing(6).replace('px', ''), | ||
); | ||
export const NODE_ICON_LEFT_MARGIN = Number( | ||
THEME_COMMON.spacing(2).replace('px', ''), | ||
); | ||
export const NODE_BORDER_WIDTH = 1; |
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.
why not in a separated file in workflow-diagram/constants/
0b3b2ef
to
8dcb36e
Compare
Log
|
- Go over every node in the workflows and fix the styles to conform to Figma - Create stories for every node type