-
Notifications
You must be signed in to change notification settings - Fork 38
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 OverflowContainer
wrapper around useOverflow
#2152
Conversation
Temporarily remove unnecessary CI jobs.
packages/itwinui-react/src/utils/components/OverflowContainer.tsx
Outdated
Show resolved
Hide resolved
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.
While this isn't exactly what I had envisioned from an OverflowContainer
component (esp. the whole context thing), I don't want to block the PR and I don't have the time to look more deeply and make better suggestions. So I'm ok with this, especially since it's an internal component.
What follows is mostly minor comments around code structure.
packages/itwinui-react/src/utils/components/OverflowContainer.tsx
Outdated
Show resolved
Hide resolved
packages/itwinui-react/src/utils/components/OverflowContainer.tsx
Outdated
Show resolved
Hide resolved
Co-authored-by: Mayank <[email protected]>
06f48ab
to
33a02d6
Compare
…without-new-algorithm
…iner-without-new-algorithm
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.
LGTM! I have no further suggestions :)
Changes
Pulled out of #2120 as PR 3 in the PR stack (PR stack order).
This just adds the
OverflowContainer
component from the combined PR but continues to use the existinguseOverflow
algorithm. Additionally, all components now useOverflowContainer
instead ofuseOverflow
.OverflowContainer
: Takes theitems
prop (would likely be removed in later PRs in the PR stack), passes it touseOverflow()
, and put the returnedvisibleItems
along with theitems.length
in a context.useOverflowContainerContext()
: Can be used in components underOverflowContainer
to access the context values in OverflowContainer. (#2152 (comment))OverflowContainer.OverflowNode
: Wrap overflow content in this component to conditionally render it when overflowing.I also had to make a small css change to make the
iui-breadcrumbs-list
stretch to the width ofiui-breadcrumbs
. This was needed to constrain the width and thus trigger an overflow when the width of the container is smaller than the required width.Testing
Docs
OverflowContainer
's API will change, the JSDocs are currently concise. They will be expanded upon in later PRs in this PR stack.After PR TODOs: