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

multiple storybook fixes and general enhancements #5991

Merged
merged 7 commits into from
Oct 13, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 9 additions & 27 deletions .storybook/main.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import { resolve } from 'node:path';
import type { StorybookConfig } from '@storybook/nextjs';

const config: StorybookConfig = {
Expand All @@ -11,33 +10,16 @@ const config: StorybookConfig = {
],
logLevel: 'error',
staticDirs: ['../public'],
core: {
disableTelemetry: true,
builder: {
name: '@storybook/builder-webpack5',
options: { lazyCompilation: true },
},
},
previewBody:
// This `<style>` is necessary to simulate what `next-themes` (ThemeProvider) does on real applications
// `next-theme` automatically injects the color-scheme based on the system preference or the current applied theme
// on Storybook we don't use `next-theme` as we want to simulate themes
'<style>:root { color-scheme: light; } html[data-theme="dark"] { color-scheme: dark; }</style>' +
// This adds the base styling for dark/light themes within Storybook. This is a Storybook-only style
'<body class="bg-white text-neutral-950 dark:bg-neutral-950 dark:text-white"></body>',
core: { disableTelemetry: true, disableWhatsNewNotifications: true },
framework: { name: '@storybook/nextjs', options: {} },
webpackFinal: async config => {
// This allows us to resolve node_modules and everything from the Application source
config.resolve!.modules = [resolve(__dirname, '..'), 'node_modules'];

config.resolve!.alias = {
...config.resolve!.alias,
// Allows us to use `@` imports with TypeScript
'@': resolve(__dirname, '../'),
};

// We want to disable the annoying performance hints
// as we know that Storybook has big bundles
config.performance = {
...config.performance,
hints: false,
};

return config;
},
webpack: async config => ({ ...config, performance: { hints: false } }),
};

export default config;
3 changes: 0 additions & 3 deletions .storybook/preview-body.html

This file was deleted.

2 changes: 1 addition & 1 deletion tailwind.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ export default {
'./providers/**/*.tsx',
'./layouts/**/*.tsx',
'./.storybook/preview.tsx',
'./.storybook/preview-body.html',
'./.storybook/main.ts',
],
theme: {
colors: {
Expand Down
3 changes: 2 additions & 1 deletion tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@
"jsx": "preserve",
"incremental": true,
"paths": { "@/*": ["./*"] },
"plugins": [{ "name": "next" }]
"plugins": [{ "name": "next" }],
"baseUrl": "."
},
"include": [
"next-env.d.ts",
Expand Down
Loading