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

docs(tabs): add example CodeSnippet via renderContent to story #5258

Merged
merged 9 commits into from
Feb 4, 2020
Merged

docs(tabs): add example CodeSnippet via renderContent to story #5258

merged 9 commits into from
Feb 4, 2020

Conversation

jendowns
Copy link
Contributor

@jendowns jendowns commented Feb 4, 2020

Closes #5257

Originally I thought the best way to go about solving #5257 was to use the selected prop to force a rerender, but then I noticed that the storybook already had an example of that EXACT solution using renderContent

Anyway I think it would be beneficial to include a multi-line CodeSnippet example with renderContent in the Tabs story, to demonstrate how to force a rerender when a Tab is selected for tricky content that relies on refs etc.

Also, please let me know if you'd like me to add any notes on the uses of renderContent in this context 👍 (EDIT: I did add a little note to the example though)

Changelog

New

  • add CodeSnippet example to demonstrate how to use renderContent to force a rerender of tab content

Changed

  • change height of tab content in story to min-height, so that the code snippet doesn't look weird when expanded in the example.

@jendowns jendowns requested a review from a team as a code owner February 4, 2020 02:46
@ghost ghost requested review from dakahn and tw15egan February 4, 2020 02:46
@netlify
Copy link

netlify bot commented Feb 4, 2020

Deploy preview for carbon-elements ready!

Built with commit cfdba7b

https://deploy-preview-5258--carbon-elements.netlify.com

@netlify
Copy link

netlify bot commented Feb 4, 2020

Deploy preview for carbon-components-react failed.

Built with commit cfdba7b

https://app.netlify.com/sites/carbon-components-react/deploys/5e38db1eaf4e6c0008a34816

@netlify
Copy link

netlify bot commented Feb 4, 2020

Deploy preview for carbon-elements ready!

Built with commit 2b9e4e6

https://deploy-preview-5258--carbon-elements.netlify.com

@netlify
Copy link

netlify bot commented Feb 4, 2020

Deploy preview for carbon-components-react ready!

Built with commit 2b9e4e6

https://deploy-preview-5258--carbon-components-react.netlify.com

Copy link
Collaborator

@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.

Tiny styling issue, but other than that looks great! Thanks for taking the time to fix the issue 👍 ✅

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.

we can probably adjust the indentation here but otherwise looks good to me

image

@jendowns
Copy link
Contributor Author

jendowns commented Feb 4, 2020

Hey @emyarod what indentation did you have in mind? This is what it looks like in my IDE so I'm not sure what should be adjusted?

Screen Shot 2020-02-04 at 11 45 02 AM

@emyarod
Copy link
Member

emyarod commented Feb 4, 2020

@jendowns in code it would look similar to https://github.com/carbon-design-system/carbon/blob/master/packages/react/src/components/CodeSnippet/CodeSnippet-story.js#L127-L147. my screenshot is of the output in storybook

even though it's weird in the editor, in storybook the <CodeSnippet> indentation looks like this:

image

@jendowns
Copy link
Contributor Author

jendowns commented Feb 4, 2020

I'm not sure what the significance of the indentation is in this specific context, but either way: I copied the formatting of the indentation in the CodeSnippet story 👍

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.

Tabs - inactive tab content has zero height & is not remounted when selected
3 participants