Skip to content

Conversation

@dobromir-hristov
Copy link
Contributor

Bug/issue #, if applicable: 97716953

Summary

Allows for disabling the resizing of the AdjustableSidebar and setting a pre-defined width.

Dependencies

NA

Testing

Steps:

  1. Assert there are no regressions
  2. Using VueDevtools, flip the disableResizing Boolean 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.

  • Added tests
  • Ran npm test, and it succeeded
  • Updated documentation if necessary

@dobromir-hristov
Copy link
Contributor Author

@swift-ci test

Copy link
Member

@marinaaisa marinaaisa left a 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.

@dobromir-hristov
Copy link
Contributor Author

@marinaaisa refactored, thanks for the idea

type: Boolean,
default: false,
},
disableResizing: {
Copy link
Contributor

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.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

hmm.. DynamicSidebar ? 🤣 FlexibleSidebar ??? 👀

@dobromir-hristov
Copy link
Contributor Author

@swift-ci test

@dobromir-hristov dobromir-hristov merged commit 32b16c7 into swiftlang:main Sep 26, 2022
@dobromir-hristov dobromir-hristov deleted the dhristov/r97716953-allow-hardcoding-sidebar-width branch September 26, 2022 06:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants