Browse Source

add: add info

Roxas 3 years ago
parent
commit
a85bb47627
2 changed files with 13 additions and 4 deletions
  1. 9
    4
      .storybook/webpack.config.js
  2. 4
    0
      stories/comment.stories.jsx

+ 9
- 4
.storybook/webpack.config.js View File

49
   config.module.rules.push({
49
   config.module.rules.push({
50
     test: /\.(ts|tsx)$/,
50
     test: /\.(ts|tsx)$/,
51
     use: [
51
     use: [
52
+      // Optional
53
+      {
54
+        loader: require.resolve("react-docgen-typescript-loader"),
55
+        options: {
56
+          // Provide the path to your tsconfig.json so that your stories can
57
+          // display types from outside each individual story.
58
+          tsconfigPath: path.resolve(__dirname, "../tsconfig.json"),
59
+        },
60
+      },
52
       {
61
       {
53
         loader: require.resolve('babel-loader'),
62
         loader: require.resolve('babel-loader'),
54
         options: {
63
         options: {
55
           presets: [['react-app', { flow: false, typescript: true }]],
64
           presets: [['react-app', { flow: false, typescript: true }]],
56
         }
65
         }
57
       },
66
       },
58
-      // Optional
59
-      {
60
-        loader: require.resolve("react-docgen-typescript-loader")
61
-      },
62
     ]
67
     ]
63
   });
68
   });
64
   config.resolve.extensions.push(".ts", ".tsx");
69
   config.resolve.extensions.push(".ts", ".tsx");

+ 4
- 0
stories/comment.stories.jsx View File

1
 import React from 'react';
1
 import React from 'react';
2
+import { withInfo } from "@storybook/addon-info";
2
 import CommentDemo from '@/components/comment/demo';
3
 import CommentDemo from '@/components/comment/demo';
3
 
4
 
4
 export default {
5
 export default {
5
   title: 'Comment',
6
   title: 'Comment',
7
+  decorators: [
8
+    withInfo,
9
+  ]
6
 };
10
 };
7
 
11
 
8
 export const comment = () => {
12
 export const comment = () => {