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

Storybook Getting Started page has styling issues #825

Closed
1 task
jattasNI opened this issue Nov 15, 2022 · 4 comments
Closed
1 task

Storybook Getting Started page has styling issues #825

jattasNI opened this issue Nov 15, 2022 · 4 comments
Assignees
Labels
bug Something isn't working

Comments

@jattasNI
Copy link
Contributor

jattasNI commented Nov 15, 2022

🐛 Bug Report

https://nimble.ni.dev/storybook/?path=/docs/getting-started--page used to show content that explained how to use Storybook but now it's a blank grey page.

💻 Repro or Code Sample

https://nimble.ni.dev/storybook/?path=/docs/getting-started--page

🤔 Expected Behavior

It should show the page containing this image:
https://github.com/ni/nimble/blob/main/packages/nimble-components/docs/storybook-overview.png?raw=true

😯 Current Behavior

It shows a blank grey screen:

image

💁 Possible Solution

🔦 Context

🌍 Your Environment

  • OS & Device: [e.g. MacOS, iOS, Windows, Linux] on [iPhone 7, PC]
  • Browser [e.g. Microsoft Edge, Google Chrome, Apple Safari, Mozilla FireFox]
  • Version [e.g. 1.8.0]

Related PRs

@jattasNI jattasNI added bug Something isn't working triage New issue that needs to be reviewed labels Nov 15, 2022
@jattasNI jattasNI changed the title Storybook Getting Starteg page is blank Storybook Getting Started page is blank Nov 15, 2022
@jattasNI
Copy link
Contributor Author

jattasNI commented Nov 15, 2022

I see the following error in the console: TypeError: _mdx_js_react.mdx is not a function

This might be related to #806. There's a long thread in this storybook issue about MDX 2 not working with storybook 6.5.x (which we're on).

@m-akinc m-akinc removed the triage New issue that needs to be reviewed label Nov 29, 2022
@rajsite rajsite mentioned this issue Dec 14, 2022
1 task
@nate-ni nate-ni moved this to 🏗 In progress in Nimble Design System Priorities Dec 15, 2022
@jattasNI jattasNI changed the title Storybook Getting Started page is blank Storybook Getting Started page has styling issues Dec 15, 2022
@jattasNI
Copy link
Contributor Author

The PR above fixed the blank page but there are still styling issues. I renamed the bug and updated the description.

@jattasNI
Copy link
Contributor Author

jattasNI commented Jan 3, 2023

Storybook 7 is now in beta and they're encouraging users to try uptaking it to find compatibility issues. The improvements mentioned include better MDX support and better npm 8 support.

https://storybook.js.org/blog/7-0-beta/

The blog also links to a storybook 7 migration guide.

@m-akinc
Copy link
Contributor

m-akinc commented Jan 10, 2023

Duplicate of #943

@m-akinc m-akinc marked this as a duplicate of #943 Jan 10, 2023
@m-akinc m-akinc closed this as completed Jan 10, 2023
@nate-ni nate-ni moved this from In progress to Done in Nimble Design System Priorities Jan 11, 2023
@jattasNI jattasNI mentioned this issue Mar 29, 2023
4 tasks
jattasNI added a commit that referenced this issue Mar 31, 2023
# Pull Request

## 🤨 Rationale

We want to be on the latest storybook version because it fixes issues
we've had with dependencies and it enables more powerful docs pages via
mdx and Component Story Format enhancements.

Notable changes:
- landing page uses correct fonts and errors in console are gone (fixing
#825 and #943 properly)
- [no more Docs
tab](https://github.com/storybookjs/storybook/blob/next/MIGRATION.md#70-docs-changes).
Each story group has a docs page under it instead.
- XD previews are gone (feature was deprecated)
- Actions not working yet and some code previews have stopped working;
see "Follow ups" below

## 👩‍💻 Implementation

Following the [upgrade
guide](https://storybook.js.org/docs/react/configure/upgrading#prereleases)
didn't work very well because it is buggy with a monorepo. Fred's
general strategy was to run the upgrade command from within
`nimble-components` then delete the `node_modules` and
`package-lock.json` that it creates there, then re-install everything
from the root. The migration tool is responsible for the changes to:
1. storybook configuration files
2. package.json
3. renaming types like `Story` -> `StoryFn` and `storyName` to `name`
4. deleting the `withXD` decorator which is no longer supported

Beyond that there were a few other manual changes:
1. establish static dependencies on components needed by each story.
Storybook seems to have gotten more aggressive about compiling away
unneeded components so if something isn't imported, it won't be found
and components won't render correctly. This meant:
1. replacing a few literals for element tag names in stories with the
`elementTag` export
2. updating the `nimble-menu` to explicitly depend on
`nimble-anchored-region` (see comment on `menu/index.ts`)
2. Enable 'autodocs' for component and token stories but disable it for
test stories
3. Add a patch file to work around
storybookjs/storybook#21820
4. simplified return types of story generation functions in
`storybook.ts` in response to storybook type changes
5. regenerated landing page screenshot and annotation now that docs tab
is gone

## 🔜 Follow ups in future PRs

Fixing these issues is tracked by #1146 . I tried upgrading to ts 4.7
but it didn't fix any of them.

- [ ] storybookjs/storybook#21820
- [ ] Figure out why actions aren't firing when you click a button.
Likely [need this
decorator](https://github.com/storybookjs/storybook/blob/next/MIGRATION.md#removed-auto-injection-of-storybookaddon-actions-decorator)
but it's not present in current rc:
storybookjs/storybook#21308
- [ ] Some code previews (table, tooltip) are not available in the Docs
page

## 🧪 Testing

Chromatic caught several diffs which resulted in the manual changes
described above 👍. ~~It's still showing new stories for the wafer map
and button. (The wafer map one is caused by Chromatic getting confused
when I tried renaming that story, ran a Chromatic build, and then
reverted that change. I don't know the cause of the button change.)~~ <-
this went away on a subsequent build

Also manually spot checked many of the stories across browsers,
especially ones that have workarounds in them like table and theme-aware
tokens.

## ✅ Checklist

<!--- Review the list and put an x in the boxes that apply or ~~strike
through~~ around items that don't (along with an explanation). -->

- [x] I have updated the project documentation to reflect my changes or
determined no changes are needed.

---------

Co-authored-by: Fred Visser <1458528+fredvisser@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
Development

No branches or pull requests

3 participants