-
Notifications
You must be signed in to change notification settings - Fork 2.4k
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
New sidemenu for notes editor #6527
Conversation
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 introduces a custom side menu for the block editor, enhancing the user experience with new components and styles.
- New Custom Side Menu: Added
CustomSideMenu.tsx
to provide block editing options. - Block Addition Component: Introduced
CustomAddBlockItem.tsx
for adding new blocks. - Side Menu Options: Added
CustomSideMenuOptions.tsx
for menu item styling. - Editor Styling: Updated
BlockEditor.tsx
with new styles for better UI consistency. - Layout Adjustment: Modified
ShowPageActivityContainer.tsx
to increase top margin for improved layout.
6 file(s) reviewed, 7 comment(s)
Edit PR Review Bot Settings
}; | ||
return ( | ||
<button | ||
className="mantine-focus-auto m_99ac2aa1 mantine-Menu-item bn-menu-item m_87cf2631 mantine-UnstyledButton-root" |
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 using a more descriptive class name instead of mantine-focus-auto
.
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.
Seems strange to have m_99ac2aa1
or m_87cf2631
, are you sure we need those?
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.
Will get back to you about this with some more clarity
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.
Hey @FelixMalfait,
I checked the classes m_99ac2aa1 and m_87cf2631 in the code. They’re handling specific styles like padding, cursor behavior, and other appearance settings using Mantine’s spacing and color variables.
If we want to avoid using these Mantine utility classes, I can replicate the styles manually. The only thing to consider would be how to handle Mantine’s spacing variables like --mantine-spacing-xs
and --mantine-spacing-sm
ourselves.
Let me know if you prefer that approach, or if you’re okay with keeping these classes for now.
// eslint-disable-next-line react/jsx-props-no-spreading | ||
<SideMenu {...props}> |
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 removing the eslint-disable comment by refactoring to avoid prop spreading.
// eslint-disable-next-line react/jsx-props-no-spreading | ||
{...props} |
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: Avoid prop spreading to improve maintainability and readability.
// eslint-disable-next-line react/jsx-props-no-spreading | ||
<DragHandleMenu {...props}> |
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: Refactor to avoid prop spreading for better code quality.
{/* eslint-disable-next-line react/jsx-props-no-spreading */} | ||
<BlockColorsItem {...props}> |
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: Prop spreading should be avoided to prevent potential bugs.
{/* eslint-disable-next-line react/jsx-props-no-spreading */} | ||
<RemoveBlockItem {...props}> |
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: Avoid using prop spreading to enhance code clarity.
packages/twenty-front/src/modules/ui/input/editor/components/CustomSideMenuOptions.tsx
Outdated
Show resolved
Hide resolved
packages/twenty-front/src/modules/ui/input/editor/components/CustomSideMenuOptions.tsx
Outdated
Show resolved
Hide resolved
packages/twenty-front/src/modules/ui/input/editor/components/CustomSideMenuOptions.tsx
Outdated
Show resolved
Hide resolved
className="mantine-focus-auto m_99ac2aa1 mantine-Menu-item bn-menu-item m_87cf2631 mantine-UnstyledButton-root" | ||
onClick={handleClick} | ||
> | ||
<Components.Generic.Menu.Item onClick={handleClick}> |
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.
That makes so much more sense. haha mb
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.
Great work!!! thank you
Log
|
editor, | ||
children, | ||
}: CustomAddBlockItemProps) => { | ||
const Components = useComponentsContext(); |
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.
@FelixMalfait
this should've been const Components = useComponentsContext()!
to remove ts errors.
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.
Ah damn, I don't really like the const Components = useComponentsContext()!
but should have done an if() + return
to avoid the scenario where it's null. Would you mind raising a PR for this? Otherwise I will do it today! Thanks a lot!
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 will raise it dw. Will also remove some of the entityId ts errors. ps: there are 3 of them
Will clean it up
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.
Thanks!!!
@Bonapara @lucasbordeau
This PR addresses issue #6489:
Review Request
Please review the implementation of the custom sidemenu.
Outstanding Issues
Sidemenu Positioning:
Props Spreading in
CustomSidemenu.tsx
:Your insights on these challenges would be greatly appreciated, especially regarding the sidemenu positioning and any potential alternatives to props spreading.
2024-08-04.14-32-37.mp4