-
-
Notifications
You must be signed in to change notification settings - Fork 9.8k
Docs: Fix broken links in framework pages #33369
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
Changes from 2 commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -60,4 +60,4 @@ function HelloWorld() { | |
| } | ||
|
|
||
| export default HelloWorld; | ||
| ``` | ||
| ``` | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,11 +1,11 @@ | ||
| ```shell renderer="react-native-web" language="js" packageManager="npm" | ||
| ```shell renderer="common" language="js" packageManager="npm" | ||
| npm install --save-dev @storybook/react-native-web-vite vite | ||
| ``` | ||
|
|
||
| ```shell renderer="react-native-web" language="js" packageManager="pnpm" | ||
| ```shell renderer="common" language="js" packageManager="pnpm" | ||
jonniebigodes marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| pnpm add --save-dev @storybook/react-native-web-vite vite | ||
| ``` | ||
|
|
||
| ```shell renderer="react-native-web" language="js" packageManager="yarn" | ||
| ```shell renderer="common" language="js" packageManager="yarn" | ||
jonniebigodes marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| yarn add --dev @storybook/react-native-web-vite vite | ||
| ``` | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -14,7 +14,7 @@ To install Storybook in an existing Angular project, run this command in your pr | |
|
|
||
| <CodeSnippets path="create-command.md" variant="new-users" copyEvent="CreateCommandCopy" /> | ||
|
|
||
| You can then get started [writing stories](/docs/get-started/whats-a-story/), [running tests](/docs/writing-tests/) and [documenting your components](/docs/writing-docs/). For more control over the installation process, refer to the [installation guide](/docs/install/). | ||
| You can then get started [writing stories](../whats-a-story.mdx), [running tests](../../writing-tests/index.mdx) and [documenting your components](../../writing-docs/index.mdx). For more control over the installation process, refer to the [installation guide](../install.mdx). | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I did find it harder for the 404 detection tool I tried to work with relative paths. I'm also myself not so keen to use relative paths because when we move a file around:
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I hear you and we need to invest in a proper way to vet the links and avoid situations like and safeguard us. |
||
|
|
||
| ### Requirements | ||
|
|
||
|
|
@@ -46,7 +46,7 @@ You will find the output in the configured `outputDir` (default is `dist/storybo | |
|
|
||
| ## Configure | ||
|
|
||
| To make the most out of Storybook in your Angular project, you can set up Compodoc integration and Storybook [decorators](/docs/writing-stories/decorators/) based on your project needs. | ||
| To make the most out of Storybook in your Angular project, you can set up Compodoc integration and Storybook [decorators](../../writing-stories/decorators.mdx) based on your project needs. | ||
|
|
||
| ### Compodoc | ||
|
|
||
|
|
@@ -122,7 +122,7 @@ export default preview; | |
|
|
||
| ### Application-wide providers | ||
|
|
||
| If your component relies on application-wide providers, like the ones defined by [`BrowserAnimationsModule`](https://angular.dev/api/platform-browser/animations/BrowserAnimationsModule) or any other modules that use the forRoot pattern to provide a [`ModuleWithProviders`](https://angular.dev/api/core/ModuleWithProviders), you can apply the `applicationConfig` [decorator](../../writing-stories/decorators.mdx) to all stories for that component. This will provide them with the [bootstrapApplication function](https://angular.io/guide/standalone-components#configuring-dependency-injection), used to bootstrap the component in Storybook. | ||
| If your component relies on application-wide providers, like the ones defined by [`BrowserAnimationsModule`](https://angular.dev/api/platform-browser/animations/BrowserAnimationsModule) or any other modules that use the forRoot pattern to provide a [`ModuleWithProviders`](https://angular.dev/api/core/ModuleWithProviders), you can apply the `applicationConfig` [decorator](../../writing-stories/decorators.mdx) to all stories for that component. This will provide them with the [bootstrapApplication function](https://angular.dev/api/platform-browser/bootstrapApplication), used to bootstrap the component in Storybook. | ||
|
|
||
| ```ts title="ChipsModule.stories.ts" | ||
| import { Meta, applicationConfig, StoryObj } from '@storybook/angular'; | ||
|
|
@@ -203,7 +203,6 @@ export const WithCustomProvider: Story = { | |
| }; | ||
| ``` | ||
|
|
||
|
|
||
| ## FAQ | ||
|
|
||
| ### How do I manually install the Angular framework? | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -6,16 +6,15 @@ sidebar: | |
| title: Next.js (Vite) | ||
| --- | ||
|
|
||
| Storybook for Next.js (Vite) is the **recommended** [framework](../../contribute/framework.mdx) for developing and testing UI components in isolation for [Next.js](https://nextjs.org/) applications. It uses [Vite](https://vitejs.dev/) for faster builds, better performance and [Storybook Testing](https://storybook.js.org/docs/writing-tests) support. | ||
| Storybook for Next.js (Vite) is the **recommended** [framework](../../contribute/framework.mdx) for developing and testing UI components in isolation for [Next.js](https://nextjs.org/) applications. It uses [Vite](https://vitejs.dev/) for faster builds, better performance and [Storybook Testing](../../writing-tests/index.mdx) support. | ||
|
|
||
| ## Install | ||
|
|
||
| To install Storybook in an existing Next.js project, run this command in your project's root directory: | ||
|
|
||
| <CodeSnippets path="create-command.md" variant="new-users" copyEvent="CreateCommandCopy" /> | ||
|
|
||
| You can then get started [writing stories](/docs/get-started/whats-a-story/), [running tests](/docs/writing-tests/) and [documenting your components](/docs/writing-docs/). For more control over the installation process, refer to the [installation guide](/docs/install/). | ||
|
|
||
| You can then get started [writing stories](../whats-a-story.mdx), [running tests](../../writing-tests/index.mdx) and [documenting your components](../../writing-docs/index.mdx). For more control over the installation process, refer to the [installation guide](../install.mdx). | ||
|
|
||
| ### Requirements | ||
|
|
||
|
|
@@ -56,9 +55,6 @@ To build Storybook, run: | |
|
|
||
| You will find the output in the configured `outputDir` (default is `storybook-static`). | ||
|
|
||
|
|
||
|
|
||
|
|
||
| ## Configure | ||
|
|
||
| Storybook for Next.js with Vite supports many Next.js features including: | ||
|
|
@@ -410,54 +406,60 @@ const preview: Preview = { | |
|
|
||
| [`next/head`](https://nextjs.org/docs/pages/api-reference/components/head) is supported out of the box. You can use it in your stories like you would in your Next.js application. Please keep in mind, that the Head `children` are placed into the head element of the iframe that Storybook uses to render your stories. | ||
|
|
||
| ### Styling | ||
|
|
||
| #### Sass/Scss | ||
| ## Next.js styling | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The idea behind the change of headers was to have all configuration sections under "Configure". The |
||
|
|
||
| [Global Sass/Scss stylesheets](https://nextjs.org/docs/pages/building-your-application/styling/sass) are supported without any additional configuration as well. Just import them into [`.storybook/preview.js|ts`](../../configure/index.mdx#configure-story-rendering) | ||
| ### Sass/Scss | ||
|
|
||
| ```js title=".storybook/preview.js|ts" | ||
| import '../styles/globals.scss'; | ||
| ``` | ||
| [Global Sass/SCSS stylesheets](https://nextjs.org/docs/pages/building-your-application/styling/sass) are also supported without any additional configuration. Just import them into [the preview config file](../../configure/index.mdx#configure-story-rendering). | ||
|
|
||
| This will automatically include any of your [custom Sass configurations](https://nextjs.org/docs/pages/building-your-application/styling/sass#customizing-sass-options) in your `next.config.js` file. | ||
| {/* prettier-ignore-start */} | ||
|
|
||
| ```js title="next.config.js" | ||
| import * as path from 'path'; | ||
| <CodeSnippets path="nextjs-styling-sass-preview.md" /> | ||
|
|
||
| export default { | ||
| // Any options here are included in Sass compilation for your stories | ||
| sassOptions: { | ||
| includePaths: [path.join(process.cwd(), 'styles')], | ||
| }, | ||
| }; | ||
| ``` | ||
| {/* prettier-ignore-end */} | ||
|
|
||
| This will automatically include any of your [custom Sass configurations](https://nextjs.org/docs/pages/building-your-application/styling/sass#customizing-sass-options) in your Next.js config file. | ||
|
|
||
| #### CSS/Sass/Scss Modules | ||
| {/* prettier-ignore-start */} | ||
|
|
||
| <CodeSnippets path="nextjs-styling-sass-config.md" /> | ||
|
|
||
| {/* prettier-ignore-end */} | ||
|
|
||
| ### CSS/Sass/Scss Modules | ||
|
|
||
| [CSS modules](https://nextjs.org/docs/pages/building-your-application/styling/css-modules) work as expected. | ||
|
|
||
| ```jsx title="src/components/Button.jsx" | ||
| // This import will work in Storybook | ||
| import styles from './Button.module.css'; | ||
| // Sass/Scss is also supported | ||
| // import styles from './Button.module.scss' | ||
| // import styles from './Button.module.sass' | ||
| {/* prettier-ignore-start */} | ||
|
|
||
| export function Button() { | ||
| return ( | ||
| <button type="button" className={styles.error}> | ||
| Destroy | ||
| </button> | ||
| ); | ||
| } | ||
| ``` | ||
| <CodeSnippets path="nextjs-styling-css-modules.md" /> | ||
|
|
||
| {/* prettier-ignore-end */} | ||
|
|
||
| #### PostCSS | ||
| ### Styled JSX | ||
|
|
||
| Next.js lets you [customize PostCSS config](https://nextjs.org/docs/pages/building-your-application/configuring/post-css). Thus this framework will automatically handle your PostCSS config for you. | ||
| The built-in CSS-in-JS solution for Next.js is [styled-jsx](https://nextjs.org/docs/pages/building-your-application/styling/css-in-js), and this framework supports that out of the box, too, with zero config. | ||
|
|
||
| {/* prettier-ignore-start */} | ||
|
|
||
| <CodeSnippets path="nextjs-styling-styled-jsx-component.md" /> | ||
|
|
||
| {/* prettier-ignore-end */} | ||
|
|
||
| ### Tailwind | ||
|
|
||
| This allows for cool things like zero-config Tailwind! (See [Next.js' example](https://github.com/vercel/next.js/tree/canary/packages/create-next-app/templates/default-tw)) | ||
| Tailwind in Next.js [is supported via PostCSS](https://nextjs.org/docs/app/getting-started/css#tailwind-css). Storybook will automatically handle the PostCSS config for you, including any custom PostCSS configuration, so that you can import your global CSS directly into [the preview config file](../../configure/index.mdx#configure-story-rendering): | ||
|
|
||
| {/* prettier-ignore-start */} | ||
|
|
||
| <CodeSnippets path="nextjs-styling-tailwind.md" /> | ||
|
|
||
| {/* prettier-ignore-end */} | ||
|
|
||
| ### PostCSS | ||
|
|
||
| Next.js lets you [customize PostCSS config](https://nextjs.org/docs/pages/building-your-application/configuring/post-css). Thus this framework will automatically handle your PostCSS config for you. | ||
|
|
||
| ### Imports | ||
| #### Absolute imports | ||
|
|
@@ -638,7 +640,7 @@ To enable this set the `experimentalRSC` feature flag in your `.storybook/main.j | |
|
|
||
| Setting this flag automatically wraps your story in a [Suspense](https://react.dev/reference/react/Suspense) wrapper, which is able to render asynchronous components in NextJS's version of React. | ||
|
|
||
| If this wrapper causes problems in any of your existing stories, you can selectively disable it using the `react.rsc` [parameter](https://storybook.js.org/docs/writing-stories/parameters) at the global/component/story level: | ||
| If this wrapper causes problems in any of your existing stories, you can selectively disable it using the `react.rsc` [parameter](../../writing-stories/parameters.mdx) at the global/component/story level: | ||
|
|
||
| {/* prettier-ignore-start */} | ||
|
|
||
|
|
@@ -654,7 +656,6 @@ In the future we will provide better mocking support in Storybook and support fo | |
|
|
||
| ## FAQ | ||
|
|
||
|
|
||
| ### How do I migrate from the `nextjs` (Webpack 5) addon? | ||
|
|
||
| #### Automatic migration | ||
|
|
@@ -673,7 +674,7 @@ This automigration tool performs the following actions: | |
|
|
||
| <Callout variant="info"> | ||
|
|
||
| If your project has custom Webpack configurations in `.storybook/main.js|ts` (via `webpackFinal`), you'll need to migrate those to Vite configuration (via `viteFinal`) after running this automigration. See the [Vite builder documentation](../builders/vite.mdx#migrating-from-webpack) for more information. | ||
| If your project has custom Webpack configurations in `.storybook/main.js|ts` (via `webpackFinal`), you'll need to migrate those to Vite configuration (via `viteFinal`) after running this automigration. See the [Vite builder documentation](../../builders/vite.mdx#migrating-from-webpack) for more information. | ||
|
|
||
| </Callout> | ||
|
|
||
|
|
@@ -711,8 +712,6 @@ Finally, if you were using Storybook plugins to integrate with Next.js, those ar | |
|
|
||
| {/* prettier-ignore-end */} | ||
|
|
||
|
|
||
|
|
||
| ### Stories for pages/components which fetch data | ||
|
|
||
| Next.js pages can fetch data directly within server components in the `app` directory, which often include module imports that only run in a node environment. This does not (currently) work within Storybook, because if you import from a Next.js page file containing those node module imports in your stories, your Storybook's Vite build will crash because those modules will not run in a browser. To get around this, you can extract the component in your page file into a separate file and import that pure component in your stories. Or, if that's not feasible for some reason, you can [configure Vite to handle those modules](https://vitejs.dev/config/dep-optimization-options.html#optimizedeps-exclude) in your Storybook's [`viteFinal` configuration](../../builders/vite.mdx#configuration). | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.