feat(scrollbar) add scrollbar component and story #23
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Material UI does not have a
scrollbar
component. This Storybook component/story is just a prototype created to test the behavior and styling options. Please let me know if this is correct or I should change anything. It's my first time using Storybook so I'm not sure if I did this correctly.Here are questions and challenges to keep in mind:
hidden
, or do we need both options? Thehidden
feature might impact the spacing of other elements because we need to leave empty space for the scrollbar.size
? Which elements will get which size? We need to define this well and test edge cases.hidden
scrollbar creates some challenges when combined with thehorizontal
andvertical
orientation
s. The way I implemented it, the element that has a scrollbar needs CSS for eitherpadding-right
orpadding-bottom
to match the scrollbarsize
in pixels when the scrollbar is not displayed. When the userhover
s on the element, thepadding
disappears and is replaced by the scrollbar that has the same pixel dimension. As far as I know, there aren't separate settings forvertical
orhorizontal
scrollbars. If we globally create thepadding-right
andpadding-bottom
, they will be applied to all elements, even if they don't have a scrollbar. I'm not sure how to detect if an element needs a scrollbar, and apply the correctpadding
selectively.It was possible to implement all the design specs in this isolated Storybook example, but it may be challenging to implement this in the actual Lunit Design System library. I think
scrollbar
logic might need to be applied globally because it's not always possible to know if an element needs ascrollbar
or not.In MUI, Overriding browser defaults is done in:
theme.components.MuiCssBaseline.styleOverrides
.