-
Notifications
You must be signed in to change notification settings - Fork 66
Allow disabling the sidebar resizing and setting a hard width #437
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
Allow disabling the sidebar resizing and setting a hard width #437
Conversation
…tableSidebarWidth.Fix sidebar not flush left when closed
|
@swift-ci test |
marinaaisa
left a comment
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 @dobromir-hristov , thanks for working on this, very useful!
I've been playing with the UI and I noticed a jumping issue when setting the hardWidth value to 200 and trying to resize afterwards.
This happens because the hardWidth value is lower than the minWidth.
The same happens when the hardWidth is greater than the maxWidth.
I propose to update the minWidth and maxWidth depending on the hardWidth values as:
maxWidth: ({ maxWidthPercent, windowWidth, hardWidth }) => (
Math.max(hardWidth, calcWidthPercent(maxWidthPercent, windowWidth))
),
minWidth: ({ minWidthPercent, windowWidth, hardWidth }) => (
Math.min(hardWidth, calcWidthPercent(minWidthPercent, windowWidth))
),so we avoid the jumping issue.
Let me know what you think.
As an alternative, we could also limit the hardWidth value so it is within the minWidth and maxWidth always.
|
@marinaaisa refactored, thanks for the idea |
| type: Boolean, | ||
| default: false, | ||
| }, | ||
| disableResizing: { |
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.
Also, I find it a little odd/funny that there's a component called AdjustableSidebarWidth that can be configured to not be adjustable, but I completely understand how we got here, haha 😅
Not necessary now, but maybe we should rename the component now that it can be restricted in this way.
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.
hmm.. DynamicSidebar ? 🤣 FlexibleSidebar ??? 👀
|
@swift-ci test |
Bug/issue #, if applicable: 97716953
Summary
Allows for disabling the resizing of the AdjustableSidebar and setting a pre-defined width.
Dependencies
NA
Testing
Steps:
disableResizingBoolean to true and assert you cannot resize anymore.Checklist
Make sure you check off the following items. If they cannot be completed, provide a reason.
npm test, and it succeeded