Skip to content
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

feat: upgrade and rework scroll area #529

Merged
merged 4 commits into from
Dec 18, 2024
Merged

feat: upgrade and rework scroll area #529

merged 4 commits into from
Dec 18, 2024

Conversation

ashley-hunter
Copy link
Collaborator

PR Checklist

Please check if your PR fulfills the following requirements:

PR Type

What kind of change does this PR introduce?

  • Bugfix
  • Feature
  • Code style update (formatting, local variables)
  • Refactoring (no functional changes, no api changes)
  • Build related changes
  • CI related changes
  • Documentation content changes
  • Other... Please describe:

Which package are you modifying?

  • accordion
  • alert
  • alert-dialog
  • aspect-ratio
  • avatar
  • badge
  • button
  • calendar
  • card
  • checkbox
  • collapsible
  • combobox
  • command
  • context-menu
  • data-table
  • date-picker
  • dialog
  • dropdown-menu
  • hover-card
  • icon
  • input
  • label
  • menubar
  • navigation-menu
  • pagination
  • popover
  • progress
  • radio-group
  • scroll-area
  • select
  • separator
  • sheet
  • skeleton
  • slider
  • sonner
  • spinner
  • switch
  • table
  • tabs
  • textarea
  • toast
  • toggle
  • tooltip
  • typography

What is the current behavior?

Closes #510

What is the new behavior?

Does this PR introduce a breaking change?

  • Yes
  • No

Other information

This updates the version of ngx-scrollbar. I have also changed the api a bit, however I can revert this if we feel this is not the right approach.

Essentially, there have been a few breaking API changes in the ngx-scrollbar component, removing some of the inputs that were previously available in our wrapper component. The existing spartan component only exposed a small subset of the ngx-scrollbar api and prevented a few of the more advanced features it supports.

With this change we no longer actually rely on the ng-scrollbar component, we just expose a directive to set the recommended styles, in a similar way to how we do with radio buttons etc..

This approach would help us allow the consuming application to use any version they need in future without us needing to update anything (unless the css variable names change) and allows access to all the features of the ngx-scrollbar library, rather than just the few we exposed. It also means if ngx-scrollbar removes or renames any inputs in future this will not be a breaking change on our end hopefully making this easier to manage going forward.

Keen to hear any other opinions on this change.

@ashley-hunter ashley-hunter marked this pull request as ready for review December 11, 2024 21:18
Copy link
Collaborator

@elite-benni elite-benni left a comment

Choose a reason for hiding this comment

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

In the past, we refactored some directives to components, because the dx feels better with the api.
<hlm-scroll-area> is easier than <ng-scrollbar hlm>.

But I totally agree with the points, that with external dependencies this can be tricky.
I like, that with this approach we are less dependant and it is easier to manage in the future. Additionally, I think it is good, that we don't hide features anymore.

apps/app/src/app/shared/code/code.component.ts Outdated Show resolved Hide resolved
@goetzrobin
Copy link
Collaborator

@ashley-hunter do you think it's worth the effort to write a migration script? I am trying to figure out if this is a 10 minute thing or 3 hour thing. Because obviously being in alpha is for changes like this!

@ashley-hunter
Copy link
Collaborator Author

@ashley-hunter do you think it's worth the effort to write a migration script? I am trying to figure out if this is a 10 minute thing or 3 hour thing. Because obviously being in alpha is for changes like this!

Yes, I'm happy to write a migration for this, shouldn't take me too long, just didn't want to spend the time writing one if we weren't happy with this approach, but if we are happy to go forward with this approach I'll gladly write one!

@goetzrobin
Copy link
Collaborator

I'd say let's go forward with this. I am wondering if you think we should do this fall all 3rd part libs, e.g. ng-icons being the most prominent of course

@ashley-hunter
Copy link
Collaborator Author

I'd say let's go forward with this. I am wondering if you think we should do this fall all 3rd part libs, e.g. ng-icons being the most prominent of course

Yes, I think this approach has benefits where we can, could really help avoid issues with breaking changes or libraries not being updated supporting newer angular versions etc..

ng-icons shouldn't be an issue, we can set the size using the CSS variable, and if there are any other issues I can make changes in the library itself to support whatever we need. I'm also working on removing the command component dependency so that will be one less dependency there too.

@ashley-hunter
Copy link
Collaborator Author

Added a migration generator/schematic which can be run if necessary

@goetzrobin goetzrobin merged commit 1278091 into main Dec 18, 2024
5 of 6 checks passed
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.

Update ngx-scrollbar to the latest version
3 participants