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

[Bug] Storybook - Fix Code Snippets and Custom Docs Template #328

Merged
merged 5 commits into from
May 23, 2024

Conversation

TimRoe
Copy link
Contributor

@TimRoe TimRoe commented May 21, 2024

Description of Change

Fixed issue with "Show code" dropdown not appearing in the Docs page. It's not entirely clear what fixed it--could've been the version updates I did, but it may have been fixed with Storybook 7 to work with custom doc templates (while simultaneously breaking automatic doc, reversing the issue from the prior version).

After fixing that, Button's doc was broken and wouldn't show all the possible props--this was fixed by getting rid of custom TypeScript generation.

Also after moving to the custom doc template, the controllability of props in the table broke. It appears that was due to using ArgsTable instead of Controls.

Lastly, removed the workaround links to the doc pages in the description block now that the intended method with the custom doc template is working again.

Testing

Verified everything working as expected in Web Storybook. Spot checked iOS/Android work as before.

Did notice one very minor bug in Web Storybook where the "Show code" dropdown for the Alert component changes to "No code available" toggling to whichever light/dark mode you didn't initially load into. Toggling it back or refreshing the page fixes it. Removing the Buttons from the Storybook component appeared to fix this so I think it is related to the fact that the Button props go from Primary to Base which changes the properties being sent and changes the code preview which confuses Storybook so I'm not sure it can be fixed as clearly the component's actual behavior swapping those is more important.

  • Tested on iOS
  • Tested on Android
  • Tested on Web

PR Checklist

Code reviewer validation:

  • General
    • PR is linked to ticket(s)
    • PR has changelog label applied if it's to be included in the changelog
    • Acceptance criteria:
      • All satisfied or
      • Documented reason for not being performed or
      • Split to separate ticket and ticket is linked by relevant AC(s)
    • Above PR sections adequately filled out
    • If any breaking changes, in accordance with the pre-1.0.0 versioning guidelines: a CU ticket has been created for the VA Mobile App detailing necessary adjustments with the package version that will be published by this ticket
  • Code
    • Tests are included if appropriate (or split to separate ticket)
    • New functions have proper TSDoc annotations

Publish

Changes do not warrant a new version per the versioning guidelines as they only involve Storybook, devDependencies, and removing comments in actual components which is non-functional.

@@ -21,9 +20,6 @@ module.exports = {
},
framework: '@storybook/react-webpack5',
options: { builder: { useSWC: true } }, // improves build performance
typescript: {
reactDocgen: 'react-docgen',
Copy link
Contributor Author

Choose a reason for hiding this comment

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

With Storybook 7, TypeScript is natively supported so this shouldn't be needed. This was screwing up Button's Doc page Controls panel (possibly due to the way we're currently using an enum for setting buttonType values) and I didn't notice any issues removing it.

@@ -1,6 +1,10 @@
/* do not change this file, it is auto generated by storybook. */
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Highlighting that all changes in this file happened automatically either from the storybook update process or building after update.

@TimRoe TimRoe marked this pull request as ready for review May 22, 2024 18:54
@TimRoe TimRoe requested a review from a team as a code owner May 22, 2024 18:54
Copy link
Contributor

@narin narin 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! Glad we stumbled upon some solutions here.

@TimRoe TimRoe merged commit e5dc229 into main May 23, 2024
12 of 13 checks passed
@TimRoe TimRoe deleted the bug/261-roettger-StorybookFixCodeSnippets branch May 23, 2024 21:02
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