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

New OverflowContainer wrapper around useOverflow #2152

Merged
merged 86 commits into from
Oct 17, 2024

Conversation

r100-stack
Copy link
Member

@r100-stack r100-stack commented Jul 18, 2024

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 existing useOverflow algorithm. Additionally, all components now use OverflowContainer instead of useOverflow.

  • OverflowContainer: Takes the items prop (would likely be removed in later PRs in the PR stack), passes it to useOverflow(), and put the returned visibleItems along with the items.length in a context.
  • useOverflowContainerContext(): Can be used in components under OverflowContainer 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 of iui-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

  • All tests continue to pass with some minimal changes

Docs

  • Added pertinent JSDocs.
    • Since OverflowContainer's API will change, the JSDocs are currently concise. They will be expanded upon in later PRs in this PR stack.
  • Added changeset for the CSS change.

After PR TODOs:

@r100-stack r100-stack self-assigned this Jul 18, 2024
@r100-stack r100-stack marked this pull request as ready for review July 19, 2024 16:07
@r100-stack r100-stack requested review from a team as code owners July 19, 2024 16:07
@r100-stack r100-stack requested review from mayank99 and Ben-Pusey-Bentley and removed request for a team July 19, 2024 16:07
@r100-stack r100-stack changed the base branch from r/unit-tests-to-e2e to r/overflow-container October 2, 2024 20:41
Copy link
Contributor

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

@r100-stack r100-stack force-pushed the r/overflow-container-without-new-algorithm branch from 06f48ab to 33a02d6 Compare October 11, 2024 15:57
Base automatically changed from r/overflow-container to main October 11, 2024 20:56
@r100-stack r100-stack changed the base branch from main to r/table-paginator-arrow-keys-bug October 14, 2024 20:05
Base automatically changed from r/table-paginator-arrow-keys-bug to main October 15, 2024 15:05
Copy link
Contributor

@smmr-dn smmr-dn left a 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 :)

@r100-stack r100-stack enabled auto-merge (squash) October 17, 2024 16:23
@r100-stack r100-stack merged commit dda23eb into main Oct 17, 2024
18 checks passed
@r100-stack r100-stack deleted the r/overflow-container-without-new-algorithm branch October 17, 2024 16:30
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.

4 participants