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

docs(storybook): fix code tab #1607

Merged
merged 1 commit into from
Sep 25, 2024
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
5 changes: 1 addition & 4 deletions storybook/config/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,7 @@ module.exports = {
name: '@storybook/addon-essentials',
options: { docs: false },
},
{
name: '@storybook/addon-storysource',
options: { loaderOptions: { injectDecorator: false } },
},
'@mihkeleidast/storybook-addon-source',
getAbsolutePath('@storybook/addon-a11y'),
getAbsolutePath('@storybook/preset-create-react-app'),
],
Expand Down
12 changes: 2 additions & 10 deletions storybook/config/preview.js
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
import '@fontsource/roboto/latin.css'
import { CssReset } from '@dhis2-ui/css'
import React, { Fragment } from 'react'
// import { jsxDecorator } from 'storybook-addon-jsx'
import '@storybook/addon-console'
const { withJsx } = require('@mihkeleidast/storybook-addon-source')
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I tried out using an import locally to see if it would work, and it does, but eslint complains:

Unable to resolve path to module '@mihkeleidast/storybook-addon-source'. eslint import/no-unresolved

Is that why this is a require?

It works though! 🙂

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yeah it is .. do you prefer we just disable the rule for that line?


export const decorators = [
// Enable storybook jsx visualization
// jsxDecorator,
withJsx,
/**
* Basic wrapper for all our components, styles the root elements and applies
* our css reset for consistency/
Expand Down Expand Up @@ -39,13 +38,6 @@ export const parameters = {
method: 'alphabetical',
},
},
jsx: {
filterProps: (val) => val !== undefined,
showDefaultProps: false,
functionValue: (fn) => fn.name,
tabStop: 4,
maxInlineAttributesLineLength: 80,
},
// A11y addon config
a11y: {
// the target DOM element
Expand Down
26 changes: 13 additions & 13 deletions storybook/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,23 +25,23 @@
"@dhis2-ui/css": "9.11.4",
"@dhis2/ui-constants": "9.11.4",
"@fontsource/roboto": "^4.5.0",
"@storybook/addon-a11y": "^8.0.6",
"@storybook/addon-a11y": "^8.3.3",
"@storybook/addon-console": "^3.0.0",
"@storybook/addon-essentials": "^8.0.6",
"@storybook/addon-storysource": "^8.0.6",
"@storybook/channels": "^8.0.6",
"@storybook/components": "^8.0.6",
"@storybook/core-events": "^8.0.6",
"@storybook/node-logger": "^8.0.6",
"@storybook/preset-create-react-app": "^8.0.6",
"@storybook/react": "^8.0.6",
"@storybook/theming": "^8.0.6",
"storybook-addon-jsx": "^7.3.14"
"@storybook/addon-essentials": "^8.3.3",
"@storybook/addon-storysource": "^8.3.3",
"@storybook/channels": "^8.3.3",
"@storybook/components": "^8.3.3",
"@storybook/core-events": "^8.3.3",
"@storybook/node-logger": "^8.3.3",
"@storybook/preset-create-react-app": "^8.3.3",
"@storybook/react": "^8.3.3",
"@storybook/theming": "^8.3.3",
"@mihkeleidast/storybook-addon-source": "1.0.1"
},
"devDependencies": {
"@storybook/react-webpack5": "^8.0.6",
"@storybook/react-webpack5": "^8.3.3",
"crypto-browserify": "^3.12.0",
"storybook": "^8.0.6",
"storybook": "^8.3.3",
"stream-browserify": "^3.0.0",
"styled-jsx": "^4.0.1"
}
Expand Down
Loading
Loading