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(code-snippet): showMoreLess={false} should hide button #1917

Merged
merged 3 commits into from Feb 24, 2024

Conversation

metonym
Copy link
Collaborator

@metonym metonym commented Feb 24, 2024

Fixes #1536

Currently, the following does not work as intended:

<CodeSnippet type="multi" {code} showMoreLess={false} />

The root cause is that showMoreLess is dynamically computed based on the code snippet height (the button is shown if a multi-line code snippet exceeds 255px). Additionally, the showMoreLess prop is initialized as false when it should be the opposite (allowing the consumer to set it to false).

This PR fixes the logic:

  • flip the default boolean value
  • only compute the show logic if showMoreLess is not false

Additionally, it adds the following examples to the docs:

  • "Hidden show more button"
  • "Hidden copy, show more buttons"

@metonym metonym merged commit 1901bcd into master Feb 24, 2024
3 checks passed
@metonym metonym deleted the fix-code-snippet-show-more-less branch February 24, 2024 18:25
@metonym
Copy link
Collaborator Author

metonym commented Feb 26, 2024

Released in v0.82.11.

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.

Disable "show more" button for CodeSnippet
1 participant