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

fix(CodeSnippet): observe resize #5854

Merged
merged 4 commits into from
Apr 20, 2020

Conversation

asudoh
Copy link
Contributor

@asudoh asudoh commented Apr 14, 2020

This change makes <CodeSnippet> observes for the resize of its top-level element so the visibility of Show More button can be updated upon the up-to-date element size.

Fixes #5819.

Changelog

Changed

  • Replaces useLayoutEffect() with useResizeObserver() to watch for the change in element size to show/hide Show More button.

Testing / Reviewing

Testing should make sure <CodeSnippet> is not broken.

This change makes `<CodeSnippet>` observes for the resize of its
top-level element so the visibility of Show More button can be updated
upon the up-to-date element size.

Fixes carbon-design-system#5819.
@asudoh asudoh requested review from emyarod and a team April 14, 2020 11:33
@ghost ghost requested review from dakahn and removed request for a team April 14, 2020 11:33
@netlify
Copy link

netlify bot commented Apr 14, 2020

Deploy preview for carbon-elements ready!

Built with commit e4409c9

https://deploy-preview-5854--carbon-elements.netlify.app

@netlify
Copy link

netlify bot commented Apr 14, 2020

Deploy preview for carbon-components-react ready!

Built with commit e4409c9

https://deploy-preview-5854--carbon-components-react.netlify.app

Copy link
Member

@emyarod emyarod left a comment

Choose a reason for hiding this comment

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

looks good to me

image

image

Copy link
Member

@tw15egan tw15egan left a comment

Choose a reason for hiding this comment

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

LGTM 👍 ✅

@tw15egan tw15egan merged commit f18dedd into carbon-design-system:master Apr 20, 2020
@asudoh asudoh deleted the code-snippet-resize branch April 21, 2020 00:38
joshblack pushed a commit to joshblack/carbon that referenced this pull request Apr 23, 2020
This change makes `<CodeSnippet>` observes for the resize of its
top-level element so the visibility of Show More button can be updated
upon the up-to-date element size.

Fixes carbon-design-system#5819.

Co-authored-by: TJ Egan <tw15egan@gmail.com>
joshblack pushed a commit to joshblack/carbon that referenced this pull request Apr 23, 2020
This change makes `<CodeSnippet>` observes for the resize of its
top-level element so the visibility of Show More button can be updated
upon the up-to-date element size.

Fixes carbon-design-system#5819.

Co-authored-by: TJ Egan <tw15egan@gmail.com>
joshblack pushed a commit that referenced this pull request Apr 23, 2020
This change makes `<CodeSnippet>` observes for the resize of its
top-level element so the visibility of Show More button can be updated
upon the up-to-date element size.

Fixes #5819.

Co-authored-by: TJ Egan <tw15egan@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Show more button does not appear when code snippet is put in a tab
4 participants