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: add stories for how PrismFormatted handles long lines #319

Merged

Conversation

huyenltnguyen
Copy link
Member

Checklist:

I was tweaking PrismFormatted storybook examples to check if the changes in freeCodeCamp/freeCodeCamp#56119 should be ported over (in other words, if the issue is in PrismFormatted or just in /learn). And since I already made the storybook changes, I thought I should just check them in since they could be useful for sanity check.

The two examples I'm adding are:

  • When PrismFormatted receives a long string
  • When PrismFormatted receives a long string, and the component is rendered inside a details element

In both cases, the string is rendered as a single line and doesn't wrap (as we expect), so I think the issue isn't in the PrismFormatted component.

Screenshot

Screenshot Screenshot 2024-09-17 at 01 19 45

Comment on lines +90 to +97
decorators: [
(Story) => (
<details>
<summary>Example code</summary>
<Story />
</details>
),
],
Copy link
Member Author

Choose a reason for hiding this comment

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

I'm using the decorators option to render <PrismFormatted {...props} /> with extra stuff.

Ref: https://storybook.js.org/docs/writing-stories/decorators?renderer=react#wrap-stories-with-extra-markup

@huyenltnguyen huyenltnguyen marked this pull request as ready for review September 16, 2024 20:10
@huyenltnguyen huyenltnguyen requested a review from a team as a code owner September 16, 2024 20:10
Copy link
Contributor

@ojeytonwilliams ojeytonwilliams left a comment

Choose a reason for hiding this comment

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

LGTM 👍

@huyenltnguyen huyenltnguyen merged commit 109f823 into freeCodeCamp:main Sep 17, 2024
7 checks passed
@huyenltnguyen huyenltnguyen deleted the docs/prism-formatted-story branch September 17, 2024 15:35
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.

2 participants