-
-
Notifications
You must be signed in to change notification settings - Fork 9.4k
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 for Storybook - step 1: ui/manager
#19465
Storybook for Storybook - step 1: ui/manager
#19465
Conversation
"addons/storyshots/*", | ||
"frameworks/*", | ||
"renderers/*", | ||
"presets/*", | ||
"examples-native/*", | ||
"examples/*", | ||
"examples-native/*", | ||
"frameworks/*", | ||
"lib/*", | ||
"lib/cli/test/run/*" | ||
"lib/cli/test/run/*", | ||
"ui/*", | ||
"presets/*", | ||
"renderers/*" | ||
] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
added ui/*
, ordered all alphabetically
useTheme, | ||
} from '@storybook/theming'; | ||
import { Symbols } from '@storybook/components'; | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This file is mostly just copied from the old official storybook example. I did however remove the logic for showing warnings about missing env.
@@ -1,7 +1,7 @@ | |||
import React, { FC, useMemo } from 'react'; | |||
import sizeMe from 'react-sizeme'; | |||
|
|||
import { State } from '@storybook/api'; | |||
import { type State } from '@storybook/api'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
all of these type imports were just an attempt at fixing eslint warnings
width, | ||
...(mocked ? mockProps : realProps), | ||
}; | ||
const props = mocked ? mockProps : realProps; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
TS correctly complained that height
and width
were always being overwritten because mockProps
and realProps
both contain them.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you TypeScript!
); | ||
return <Zoom key="zoom" {...{ zoomIn, zoomOut, reset }} />; | ||
}); | ||
const ZoomWrapper = React.memo<{ set: (zoomLevel: number) => void; value: number }>( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
butchered diff. the only change here is the better typing of the set
function.
manager/ui
manager/ui
manager/ui
ui/manager
…-604-create-a-standalone-storybook-for-our
@@ -284,6 +287,7 @@ | |||
"fs-extra": "^9.0.1", | |||
"github-release-from-changelog": "^2.1.1", | |||
"glob": "^7.1.6", | |||
"global": "^4.4.0", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this dependency was something we were in the process of removing entirely, correct @shilman?
and adding them back in, but with the `jsxRuntime: 'classic'` option. | ||
TODO: When we've upgraded to React 18 all of this shouldn't be necessary anymore | ||
*/ | ||
plugins: [...withoutReactPlugins(config.plugins), vitePluginReact({ jsxRuntime: 'classic' })], |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's (in a follow-up PR) extract this code into the react-vite framework.
We can toggle this behavior in a frameworkOption.
@shilman perhaps this is something we should do this cycle, or the next? And maybe we need a repro for react16+vite, if we do not have one yet.
We could also say react16+vite is unsupported, but that might be a bit too aggressive? (considering we ourselves are using it 🤡
@@ -0,0 +1,4 @@ | |||
<script> | |||
// eslint-disable-next-line no-undef | |||
window.global = window; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's make it a target for SB7.0 to remove this requirement?
@shilman ☝️ ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
FYI this is documented here: https://github.com/storybookjs/storybook/tree/next/code/lib/builder-vite#migration-from-webpack--cra
This PR creates a Storybook for the manager UI.
code/ui
which will contain multiple packages.lib/ui
has been moved toui/manager
, but in follow-up PRs we'll movelib/components/
,lib/docblocks
and maybe alsolib/router
.code/ui/.storybook
based onreact/vite
which will be used forui
,components
, anddocblocks
.The Storybook can be started with
(for now)