Skip to content

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