Browse Source

add: add info

Roxas 4 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,16 +49,21 @@ module.exports = ({ config }) => {
49 49
   config.module.rules.push({
50 50
     test: /\.(ts|tsx)$/,
51 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 62
         loader: require.resolve('babel-loader'),
54 63
         options: {
55 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 69
   config.resolve.extensions.push(".ts", ".tsx");

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

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