-
-
Notifications
You must be signed in to change notification settings - Fork 29
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
chore: initialize storybook using nx command #97
Merged
MFarabi619
merged 11 commits into
main
from
mfarabi/feat/96-add-storybook-with-tailwindcss-shadcn-ui-and-chromatic-visual-test-server
Nov 19, 2024
Merged
Changes from all commits
Commits
Show all changes
11 commits
Select commit
Hold shift + click to select a range
f164b1c
ci(release): fix failing due to missing token
MFarabi619 714bade
build(eslint-config-inspector): change output from 'dist/lint-inspect…
MFarabi619 6711277
feat(libs/shared/ui): create project
MFarabi619 00b248d
feat(ui/website): initialize tailwind
MFarabi619 1b3ac4b
chore(libs/shared/config): create copies of common setups
MFarabi619 ac01dc7
feat(ui/website): use shared libs configs
MFarabi619 ec49054
chore(config): add git clean script
MFarabi619 4a89083
feat(ui/website): render shadcn component from lib
MFarabi619 12c454c
feat(libs/shared/ui): create storybook
MFarabi619 4c4d94c
ci: deploy storybook to chromatic
MFarabi619 a9180ad
refactor: reorganize libs with feature sliced design and bulletproof …
MFarabi619 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
import { INITIAL_VIEWPORTS } from '@storybook/addon-viewport' | ||
|
||
export const customViewports = { | ||
...INITIAL_VIEWPORTS, | ||
'720p': { | ||
name: '720p', | ||
styles: { | ||
width: '1280px', | ||
height: '720px', | ||
}, | ||
}, | ||
'1080p': { | ||
name: '1080p', | ||
styles: { | ||
width: '1920px', | ||
height: '1080px', | ||
}, | ||
}, | ||
'2k': { | ||
name: '2K', | ||
styles: { | ||
width: '2560px', | ||
height: '1440px', | ||
}, | ||
}, | ||
'4k': { | ||
name: '4K', | ||
styles: { | ||
width: '3840px', | ||
height: '2160px', | ||
}, | ||
}, | ||
'21/9': { | ||
name: '21/9', | ||
styles: { | ||
width: '2560px', | ||
height: '1080px', | ||
}, | ||
}, | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,103 @@ | ||
import type { StorybookConfig } from '@storybook/nextjs' | ||
|
||
// import { TsconfigPathsPlugin } from 'tsconfig-paths-webpack-plugin' | ||
|
||
export default { | ||
stories: [ | ||
'../libs/external/shadcn/**/*.@(mdx|stories.@(js|jsx|ts|tsx))', | ||
'../libs/shared/ui/**/*.@(mdx|stories.@(js|jsx|ts|tsx))', | ||
], | ||
framework: { | ||
name: '@storybook/nextjs', | ||
options: {}, | ||
}, | ||
docs: {}, | ||
// Did not use @storybook/addon-essentials due to lack of toolbar ordering API | ||
addons: [ | ||
// --------------- Toolbar Icons --------------- | ||
// Ruler | ||
'@storybook/addon-measure', | ||
// Phone | ||
'@storybook/addon-viewport', | ||
// Dotted Outline | ||
'@storybook/addon-outline', | ||
// Sun/Moon icon. Toggle Manager, Preview Components, and Preview Background | ||
'storybook-dark-mode', | ||
// Pen. Toggle both Preview Components and Preview Background | ||
'@storybook/addon-themes', | ||
// Portrait. Toggle only Preview Background. Not affected by other two, use to 'lock' the background. | ||
'@storybook/addon-backgrounds', | ||
|
||
// --------------- Action Bar --------------- | ||
// https://storybook.js.org/docs/essentials/controls | ||
'@storybook/addon-controls', | ||
// Person inside circle icon. Also 'Accessibility' tab to action bar | ||
'@storybook/addon-a11y', | ||
// Accessibility tab added by '@storybook/addon-a11y' | ||
{ | ||
name: '@storybook/addon-designs', // Actually has amazing docs for once: https://storybookjs.github.io/addon-designs/?path=/docs/docs-quick-start--docs | ||
options: { | ||
// renderTarget: 'canvas' | 'tab' | ||
}, | ||
}, | ||
// https://storybook.js.org/docs/essentials/actions | ||
'@storybook/addon-actions', | ||
// https://storybook.js.org/docs/essentials/interactions | ||
'@storybook/addon-interactions', // Must be listed after @storybook/addon-actions or @storybook/addon-essentials | ||
|
||
// '@chromatic-com/storybook', | ||
// Code for component story | ||
// { | ||
// name: '@storybook/addon-storysource', | ||
// options: { | ||
// rule: { | ||
// test: [/\.stories\.tsx?$/], | ||
// include: [path.resolve(__dirname, '../src')], // You can specify directories | ||
// }, | ||
// loaderOptions: { | ||
// parser: 'typescript', | ||
// injectStoryParameters: false, | ||
// prettierConfig: { printWidth: 80, singleQuote: false }, | ||
// }, | ||
// enforce: 'pre', | ||
// }, | ||
// }, | ||
'@storybook/addon-links', | ||
|
||
// --------------- No-icons --------------- | ||
// Onboarding flow | ||
// '@storybook/addon-onboarding', | ||
// Custom toolbars | ||
// '@storybook/addon-toolbars', | ||
// Auto-generate MDX/React/JSX documentation for components | ||
// https://github.com/storybookjs/storybook/tree/next/code/addons/docs | ||
{ | ||
name: '@storybook/addon-docs', | ||
options: { | ||
// csfPluginOptions: null, | ||
// mdxPluginOptions: { | ||
// mdxCompileOptions: { | ||
// remarkPlugins: [], | ||
// }, | ||
// }, | ||
sourceLoaderOptions: { | ||
injectStoryParameters: false, | ||
}, | ||
}, | ||
}, | ||
// HTML Tab in action bar | ||
// https://github.com/whitespace-se/storybook-addon-html | ||
'@whitespace/storybook-addon-html', | ||
], | ||
// webpackFinal: async (config) => { | ||
// if (config.resolve) { | ||
// config.resolve.plugins = [ | ||
// ...(config.resolve.plugins || []), | ||
// new TsconfigPathsPlugin({ | ||
// configFile: './tsconfig.storybook.json', | ||
// }), | ||
// ] | ||
// } | ||
// return config | ||
// }, | ||
} satisfies StorybookConfig |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
💡 Codebase verification
Path aliases are configured - enable TsconfigPathsPlugin for Storybook
The codebase has path aliases configured in the base tsconfig.json:
@shadcn
->libs/external/shadcn
@cuhacking
->libs/shared
You should uncomment and use the TsconfigPathsPlugin to enable these path aliases in Storybook stories.
🔗 Analysis chain
Consider implementing path aliasing for better imports
The commented out
TsconfigPathsPlugin
import suggests incomplete path aliasing setup. This could make imports in stories more verbose.🏁 Scripts executed
The following scripts were executed for the analysis:
Script:
Length of output: 7455