Browse Source

dev: 接入storybook

Roxas 5 years ago
parent
commit
9767067ffe

+ 8
- 0
.storybook/addons.js View File

@@ -0,0 +1,8 @@
1
+import '@storybook/addon-actions/register';
2
+import '@storybook/addon-links/register';
3
+import '@storybook/addon-notes/register';
4
+import '@storybook/addon-knobs/register';
5
+import '@storybook/addon-viewport/register';
6
+import '@storybook/addon-console';
7
+import '@storybook/addon-storysource/register';
8
+import 'storybook-readme/register';

+ 22
- 0
.storybook/config.js View File

@@ -0,0 +1,22 @@
1
+import { configure, getStorybook } from '@storybook/react';
2
+import { addParameters } from '@storybook/react';
3
+import { INITIAL_VIEWPORTS } from '@storybook/addon-viewport';
4
+import { addDecorator } from '@storybook/react';
5
+import { withConsole } from '@storybook/addon-console';
6
+
7
+addParameters({
8
+  info: { inline: true },
9
+  viewport: {
10
+    viewports: INITIAL_VIEWPORTS,
11
+    defaultViewport: 'someDefault',
12
+  },
13
+});
14
+// automatically import all files ending in *.stories.tsx
15
+configure(
16
+  require.context('../stories', true, /\.stories\.tsx?$/), module
17
+)
18
+
19
+addDecorator((storyFn, context) => withConsole()(storyFn)(context));
20
+
21
+import 'antd/dist/antd.less';
22
+export { getStorybook }

+ 71
- 0
.storybook/webpack.config.js View File

@@ -0,0 +1,71 @@
1
+const fs = require('fs');
2
+const path = require('path');
3
+
4
+module.exports = ({ config }) => {
5
+  config.module.rules.push({
6
+    test: /\.stories\.tsx?$/,
7
+    loaders: [require.resolve('@storybook/source-loader')],
8
+    enforce: 'pre',
9
+  });
10
+  config.module.rules.push({
11
+    test: /\.less$/,
12
+    include: /node_modules|antd\.less/,
13
+    use: [
14
+      "style-loader",
15
+      "css-loader",
16
+      {
17
+        loader: "less-loader",
18
+        options: {
19
+          javascriptEnabled: true
20
+        }
21
+      }
22
+    ]
23
+  });
24
+  config.module.rules.push({
25
+    test: /\.less$/,
26
+    use: [
27
+    'style-loader', 
28
+    {
29
+      loader: 'css-loader',// translates CSS into CommonJS
30
+      options: {
31
+        modules: {
32
+          localIdentName: '[name]__[local]___[hash:base64:5]',
33
+        },
34
+      }
35
+    },
36
+    'postcss-loader',
37
+    {
38
+      loader: 'less-loader',
39
+      options: {
40
+        javascriptEnabled: true,
41
+      },
42
+    }],
43
+    exclude: /node_modules|antd\.less/,
44
+  });
45
+  config.module.rules.push({
46
+    test: /\.(ts|tsx)$/,
47
+    use: [
48
+      {
49
+        loader: require.resolve('babel-loader'),
50
+        options: {
51
+          presets: [['react-app', { flow: false, typescript: true }]],
52
+          "plugins": [
53
+            ["import", { "libraryName": "antd", "style": true }]
54
+          ]
55
+        }
56
+      },
57
+      // Optional
58
+      {
59
+        loader: require.resolve("react-docgen-typescript-loader")
60
+      },
61
+    ]
62
+  });
63
+  config.resolve.extensions.push(".ts", ".tsx");
64
+  config.resolve.alias = {
65
+    ...config.resolve.alias,
66
+    '@': `${path.resolve(fs.realpathSync(process.cwd()), './src')}`,
67
+    '@components': `${path.resolve(fs.realpathSync(process.cwd()), './src')}/components`,
68
+  }
69
+  config.output.library = "[name]";
70
+  return config;
71
+};

+ 1
- 1
config-overrides.js View File

@@ -8,7 +8,7 @@ module.exports = function override(config, env) {
8 8
   config.resolve.extensions = ['.js', '.jsx', '.ts', '.tsx', '.less', '.json'];
9 9
   config.resolve.alias = {
10 10
     '@': srcPath,
11
-    '@components': `${srcPath}srcPath/components`,
11
+    '@components': `${srcPath}/components`,
12 12
   };
13 13
   config.module.rules.push({
14 14
     test: /\.less$/,

+ 23
- 1
package.json View File

@@ -26,7 +26,9 @@
26 26
     "eject": "react-app-rewired eject",
27 27
     "build:lib": "rimraf lib && babel src/components --out-dir lib  --source-maps  --copy-files --extensions \".ts,.tsx\"",
28 28
     "build:css:": "",
29
-    "build:rollup": "rimraf lib && rollup -c ./rollup.config.js"
29
+    "build:rollup": "rimraf lib && rollup -c ./rollup.config.js",
30
+    "storybook": "start-storybook -p 9009 -s public",
31
+    "build-storybook": "build-storybook -s public"
30 32
   },
31 33
   "eslintConfig": {
32 34
     "extends": "react-app"
@@ -57,14 +59,33 @@
57 59
     "@rollup/plugin-image": "^2.0.0",
58 60
     "@rollup/plugin-node-resolve": "^6.0.0",
59 61
     "@rollup/plugin-url": "^4.0.0",
62
+    "@storybook/addon-actions": "^5.2.8",
63
+    "@storybook/addon-console": "^1.2.1",
64
+    "@storybook/addon-info": "^5.2.8",
65
+    "@storybook/addon-knobs": "^5.2.8",
66
+    "@storybook/addon-links": "^5.2.8",
67
+    "@storybook/addon-notes": "^5.2.8",
68
+    "@storybook/addon-storysource": "^5.2.8",
69
+    "@storybook/addon-viewport": "^5.2.8",
70
+    "@storybook/addons": "^5.2.8",
71
+    "@storybook/react": "^5.2.8",
72
+    "@types/storybook-readme": "^5.0.4",
73
+    "@types/storybook__addon-info": "^5.2.1",
74
+    "antd": "^3.26.4",
60 75
     "autoprefixer": "^9.7.3",
61 76
     "babel-loader": "^8.0.6",
62 77
     "babel-plugin-import": "^1.13.0",
63 78
     "cross-env": "^6.0.3",
64 79
     "less": "^3.10.3",
80
+    "less-loader": "^5.0.0",
81
+    "css-loader": "^3.2.1",
82
+    "file-loader": "^5.0.2",
83
+    "postcss-loader": "^3.0.0",
84
+    "style-loader": "^1.0.1",
65 85
     "node-eval": "^2.0.0",
66 86
     "postcss-url": "^8.0.0",
67 87
     "react-app-rewired": "^2.1.5",
88
+    "react-docgen-typescript-loader": "^3.6.0",
68 89
     "rimraf": "^3.0.0",
69 90
     "rollup": "^1.27.13",
70 91
     "rollup-plugin-alias": "^2.2.0",
@@ -76,6 +97,7 @@
76 97
     "rollup-plugin-peer-deps-external": "^2.2.0",
77 98
     "rollup-plugin-postcss-modules": "^2.0.1",
78 99
     "rollup-plugin-replace": "^2.2.0",
100
+    "storybook-readme": "^5.0.8",
79 101
     "ts-loader": "^6.2.1"
80 102
   },
81 103
   "peerDependencies": {

+ 3
- 0
postcss.config.js View File

@@ -0,0 +1,3 @@
1
+module.exports = {  
2
+  plugins: {}
3
+} 

+ 0
- 1
rollup.config.js View File

@@ -40,7 +40,6 @@ const cModuleMap = cModuleNames.reduce((prev, name) => {
40 40
   prev[name] = `${componentFold}/${name}/index.ts`;
41 41
   return prev;
42 42
 }, {});
43
-console.log('cModuleMap: ', cModuleMap);
44 43
 
45 44
 const extensions = ['.js', '.jsx', '.ts', '.tsx'];
46 45
 

+ 1
- 1
src/components/Payment/Common/PayPlatformOptions/index.tsx View File

@@ -228,4 +228,4 @@ class PayPlatformOptions extends PureComponent<Props, {}> {
228 228
   }
229 229
 }
230 230
 
231
-export default PayPlatformOptions;
231
+export default PayPlatformOptions;

+ 22
- 23
src/components/Payment/Common/PriceOptions/index.tsx View File

@@ -1,10 +1,11 @@
1
-import React, { useState } from 'react';
2
-import { Input } from 'antd';
3
-import { FormattedMessage, useIntl } from 'react-intl';
4
-import classnames from 'classnames';
5
-import { formatMoney } from '../../Utils/utils';
1
+import React, { useState } from "react";
2
+import { Input } from "antd";
3
+import classnames from "classnames";
4
+import { formatMoney } from "../../Utils/utils";
6 5
 
7
-import styles from './PriceOptions.less';
6
+import styles from "./PriceOptions.less";
7
+
8
+const FormattedMessage = ({ id }: any) => id;
8 9
 
9 10
 type Props = {
10 11
   price: number;
@@ -13,17 +14,16 @@ type Props = {
13 14
   focusScroll: boolean;
14 15
   withTitle: boolean;
15 16
   inputRef: React.RefObject<Input>;
16
-}
17
+};
17 18
 
18 19
 const PriceOptions = ({
19 20
   price,
20 21
   onPriceChange,
21
-  size = 'normal',
22
+  size = "normal",
22 23
   focusScroll = true,
23 24
   withTitle = true,
24
-  inputRef,
25
+  inputRef
25 26
 }: Props) => {
26
-  const intl = useIntl();
27 27
   const defaultOptions = [100, 600, 800];
28 28
   // 控制是否为其他金额输入情况
29 29
   const [inputStatus, setInputStatus] = useState(false);
@@ -31,17 +31,21 @@ const PriceOptions = ({
31 31
   return (
32 32
     <div
33 33
       className={classnames(styles.options, {
34
-        [styles[size]]: true,
34
+        [styles[size]]: true
35 35
       })}
36 36
     >
37
-      {withTitle ? <p><FormattedMessage id="pay.price.select.text" /></p> : null}
38
-      <div className={styles.infoItem} style={{ marginBottom: '-12px' }}>
37
+      {withTitle ? (
38
+        <p>
39
+          <FormattedMessage id="pay.price.select.text" />
40
+        </p>
41
+      ) : null}
42
+      <div className={styles.infoItem} style={{ marginBottom: "-12px" }}>
39 43
         <span className={styles.priceBtn}>
40 44
           {defaultOptions.map(item => (
41 45
             <span
42 46
               className={classnames({
43 47
                 [styles.priceItem]: true,
44
-                [styles.active]: price === item && !inputStatus,
48
+                [styles.active]: price === item && !inputStatus
45 49
               })}
46 50
               key={item}
47 51
               onClick={() => {
@@ -49,12 +53,7 @@ const PriceOptions = ({
49 53
                 setInputStatus(false);
50 54
               }}
51 55
             >
52
-              <FormattedMessage
53
-                id="pay.price.money.text"
54
-                values={{
55
-                  value: formatMoney(item / 100, 0)
56
-                }}
57
-              />
56
+              <FormattedMessage id={`${formatMoney(item/100, 0)}¥`} />
58 57
             </span>
59 58
           ))}
60 59
         </span>
@@ -68,9 +67,9 @@ const PriceOptions = ({
68 67
           }}
69 68
           suffix="¥"
70 69
           className={styles.priceInput}
71
-          value={inputStatus ? (price / 100 || '') : ''}
72
-          placeholder={intl.formatMessage({ id: 'pay.price.money.others' })}
73
-          onChange={e => {  
70
+          value={inputStatus ? price / 100 || "" : ""}
71
+          placeholder="Others"
72
+          onChange={e => {
74 73
             const n = +e.target.value;
75 74
             if (Number.isNaN(n)) {
76 75
               return;

+ 0
- 9
src/lang/en.json View File

@@ -1,9 +0,0 @@
1
-{
2
-  "pay.channel.select.text": "Select Your Platform",
3
-  "pay.channel.ali": "Alipay",
4
-  "pay.channel.wechat": "WeChat Pay",
5
-  "pay.channel.paypal": "PayPal",
6
-  "pay.price.select.text": "Select Your Reward",
7
-  "pay.price.money.text": "{value}¥",
8
-  "pay.price.money.others": "others value"
9
-}

+ 0
- 9
src/lang/zh.json View File

@@ -1,9 +0,0 @@
1
-{
2
-  "pay.channel.select.text": "选择你的支付平台",
3
-  "pay.channel.ali": "支付宝",
4
-  "pay.channel.wechat": "微信",
5
-  "pay.channel.paypal": "PayPal",
6
-  "pay.price.select.text": "选择打赏金额",
7
-  "pay.price.money.text": "{value}¥",
8
-  "pay.price.money.others": "其他金额"
9
-}

+ 723
- 0
stories/data/commentlist.json View File

@@ -0,0 +1,723 @@
1
+{
2
+  "list": [
3
+    {
4
+      "id": "5de8e52a107f8a000180aa31",
5
+      "nickname": "Anonymous",
6
+      "avatar": "https://links-comment.oss-cn-beijing.aliyuncs.com/comment/20180820/Kgka4_oU1.jpeg",
7
+      "introduction": "",
8
+      "followed": 0,
9
+      "invited": false,
10
+      "fans": 0,
11
+      "follows": 0,
12
+      "user_id": 58297,
13
+      "title": "app发布问题",
14
+      "content": "",
15
+      "is_liked": false,
16
+      "likes": 0,
17
+      "reads": 0,
18
+      "shares": 0,
19
+      "is_favorited": false,
20
+      "favorites": 0,
21
+      "comment_count": 1,
22
+      "last_comment": {
23
+        "id": "5de8e542107f8a000180aa36",
24
+        "nickname": "Anonymous",
25
+        "avatar": "https://links-comment.oss-cn-beijing.aliyuncs.com/comment/20180820/Kgka4_oU1.jpeg",
26
+        "introduction": "",
27
+        "followed": 0,
28
+        "invited": false,
29
+        "fans": 0,
30
+        "follows": 0,
31
+        "user_id": 58297,
32
+        "type": 4,
33
+        "model_id": "5de8e52a107f8a000180aa31",
34
+        "model_type": "question",
35
+        "related_id": "5de8e542107f8a000180aa36",
36
+        "content": "测试闪退",
37
+        "content_text": "测试闪退",
38
+        "is_liked": true,
39
+        "is_favorited": true,
40
+        "favorites": 1,
41
+        "likes": 1,
42
+        "shares": 6,
43
+        "reads": 0,
44
+        "comment_count": 1,
45
+        "created": 1575544130,
46
+        "updated": 1575544130,
47
+        "question_title": "",
48
+        "assets": [],
49
+        "is_top": false,
50
+        "anonymity": true,
51
+        "deleted": 0,
52
+        "my_comment": {
53
+          "id": "5de8e542107f8a000180aa36",
54
+          "content": "测试转发问答。[e100][e101][e102][e103][e104][e105]",
55
+          "created": 1576083794
56
+        },
57
+        "read_times": 117,
58
+        "sort_score": 0,
59
+        "tip_num": 0,
60
+        "paid_money": 0
61
+      },
62
+      "my_comment": {
63
+        "id": "",
64
+        "nickname": "",
65
+        "avatar": "",
66
+        "introduction": "",
67
+        "followed": 0,
68
+        "invited": false,
69
+        "fans": 0,
70
+        "follows": 0,
71
+        "user_id": 0,
72
+        "type": 0,
73
+        "model_id": "",
74
+        "model_type": "",
75
+        "related_id": "",
76
+        "content": "",
77
+        "content_text": "",
78
+        "is_liked": false,
79
+        "is_favorited": false,
80
+        "favorites": 0,
81
+        "likes": 0,
82
+        "shares": 0,
83
+        "reads": 0,
84
+        "comment_count": 0,
85
+        "created": 0,
86
+        "updated": 0,
87
+        "question_title": "",
88
+        "assets": null,
89
+        "is_top": false,
90
+        "anonymity": false,
91
+        "deleted": 0,
92
+        "my_comment": {
93
+          "id": "",
94
+          "content": "",
95
+          "created": 0
96
+        },
97
+        "read_times": 0,
98
+        "sort_score": 0,
99
+        "tip_num": 0,
100
+        "paid_money": 0
101
+      },
102
+      "draft": {
103
+        "nickname": "",
104
+        "avatar": "",
105
+        "introduction": "",
106
+        "followed": 0,
107
+        "invited": false,
108
+        "fans": 0,
109
+        "follows": 0,
110
+        "id": "",
111
+        "user_id": 0,
112
+        "model_id": "",
113
+        "model_type": "",
114
+        "content": "",
115
+        "title": "",
116
+        "pure_content": "",
117
+        "content_type": "",
118
+        "created": 0,
119
+        "updated": 0,
120
+        "topic": null,
121
+        "is_long": false,
122
+        "assets": null
123
+      },
124
+      "assets": [
125
+        {
126
+          "type": "img",
127
+          "url": "https://links123-images.oss-cn-hangzhou.aliyuncs.com/question/2019/12/05/77c774eee875cc71da8183404cf39d79.png",
128
+          "width": 1488,
129
+          "height": 1984
130
+        }
131
+      ],
132
+      "is_featured": false,
133
+      "labels": [
134
+        {
135
+          "id": "5dd4006bf90b7e0001b70fe0",
136
+          "text": "测试",
137
+          "question_num": 0
138
+        },
139
+        {
140
+          "id": "5de8e506107f8a000180aa2e",
141
+          "text": "大地飞歌",
142
+          "question_num": 0
143
+        },
144
+        {
145
+          "id": "5de8e50d107f8a000180aa2f",
146
+          "text": "发广告",
147
+          "question_num": 0
148
+        },
149
+        {
150
+          "id": "5cfdef809146c10001b73fcf",
151
+          "text": "发发发",
152
+          "question_num": 0
153
+        },
154
+        {
155
+          "id": "5de8e517107f8a000180aa30",
156
+          "text": "烦烦烦",
157
+          "question_num": 0
158
+        }
159
+      ],
160
+      "anonymity": true,
161
+      "invite_users": null,
162
+      "deleted": 0,
163
+      "created": 1575544106,
164
+      "tip_num": 0,
165
+      "is_reward": false,
166
+      "money": 0
167
+    },
168
+    {
169
+      "id": "5dbe889b1c58e200016d6daa",
170
+      "nickname": "a2",
171
+      "avatar": "https://links-comment.oss-cn-beijing.aliyuncs.com/comment/20180820/Kgka4_oU1.jpeg",
172
+      "introduction": "😄",
173
+      "followed": 0,
174
+      "invited": false,
175
+      "fans": 0,
176
+      "follows": 0,
177
+      "user_id": 71789,
178
+      "title": "测试1",
179
+      "content": "",
180
+      "is_liked": false,
181
+      "likes": 0,
182
+      "reads": 0,
183
+      "shares": 0,
184
+      "is_favorited": false,
185
+      "favorites": 0,
186
+      "comment_count": 1,
187
+      "last_comment": {
188
+        "id": "5dbe95c31c58e200016d6dea",
189
+        "nickname": "Dreamssxxxxjjdjd",
190
+        "avatar": "https://links123-images.oss-cn-hangzhou.aliyuncs.com/avatar/2019/5/18/a9103c135da2844af06c6cf344ed3920.jpg",
191
+        "introduction": "hello你nncncncmcc",
192
+        "followed": 0,
193
+        "invited": false,
194
+        "fans": 0,
195
+        "follows": 0,
196
+        "user_id": 71764,
197
+        "type": 4,
198
+        "model_id": "5dbe889b1c58e200016d6daa",
199
+        "model_type": "question",
200
+        "related_id": "5dbe95c31c58e200016d6dea",
201
+        "content": "回答测试 通知",
202
+        "content_text": "回答测试 通知",
203
+        "is_liked": true,
204
+        "is_favorited": true,
205
+        "favorites": 2,
206
+        "likes": 3,
207
+        "shares": 2,
208
+        "reads": 0,
209
+        "comment_count": 2,
210
+        "created": 1572771267,
211
+        "updated": 1572771267,
212
+        "question_title": "",
213
+        "assets": [],
214
+        "is_top": false,
215
+        "anonymity": false,
216
+        "deleted": 0,
217
+        "my_comment": {
218
+          "id": "5dbe95c31c58e200016d6dea",
219
+          "content": "测",
220
+          "created": 1572785768
221
+        },
222
+        "read_times": 128,
223
+        "sort_score": 0,
224
+        "tip_num": 1,
225
+        "paid_money": 0
226
+      },
227
+      "my_comment": {
228
+        "id": "",
229
+        "nickname": "",
230
+        "avatar": "",
231
+        "introduction": "",
232
+        "followed": 0,
233
+        "invited": false,
234
+        "fans": 0,
235
+        "follows": 0,
236
+        "user_id": 0,
237
+        "type": 0,
238
+        "model_id": "",
239
+        "model_type": "",
240
+        "related_id": "",
241
+        "content": "",
242
+        "content_text": "",
243
+        "is_liked": false,
244
+        "is_favorited": false,
245
+        "favorites": 0,
246
+        "likes": 0,
247
+        "shares": 0,
248
+        "reads": 0,
249
+        "comment_count": 0,
250
+        "created": 0,
251
+        "updated": 0,
252
+        "question_title": "",
253
+        "assets": null,
254
+        "is_top": false,
255
+        "anonymity": false,
256
+        "deleted": 0,
257
+        "my_comment": {
258
+          "id": "",
259
+          "content": "",
260
+          "created": 0
261
+        },
262
+        "read_times": 0,
263
+        "sort_score": 0,
264
+        "tip_num": 0,
265
+        "paid_money": 0
266
+      },
267
+      "draft": {
268
+        "nickname": "",
269
+        "avatar": "",
270
+        "introduction": "",
271
+        "followed": 0,
272
+        "invited": false,
273
+        "fans": 0,
274
+        "follows": 0,
275
+        "id": "",
276
+        "user_id": 0,
277
+        "model_id": "",
278
+        "model_type": "",
279
+        "content": "",
280
+        "title": "",
281
+        "pure_content": "",
282
+        "content_type": "",
283
+        "created": 0,
284
+        "updated": 0,
285
+        "topic": null,
286
+        "is_long": false,
287
+        "assets": null
288
+      },
289
+      "assets": [],
290
+      "is_featured": false,
291
+      "labels": [],
292
+      "anonymity": false,
293
+      "invite_users": null,
294
+      "deleted": 0,
295
+      "created": 1572767899,
296
+      "tip_num": 0,
297
+      "is_reward": false,
298
+      "money": 0
299
+    },
300
+    {
301
+      "id": "5db305cacd9c3400015a1db4",
302
+      "nickname": "Anonymous",
303
+      "avatar": "https://links-comment.oss-cn-beijing.aliyuncs.com/comment/20180820/Kgka4_oU1.jpeg",
304
+      "introduction": "",
305
+      "followed": 0,
306
+      "invited": false,
307
+      "fans": 0,
308
+      "follows": 0,
309
+      "user_id": 58297,
310
+      "title": "2019年10月24日报道,综合报道,全球变暖可能正改变北极的地貌!俄罗斯国防部日前表示,俄海军在北极发现了5座新岛屿,正是冰川融化导致了这几座岛屿显露出来。  俄国防部表示,俄海军在2016年首次利用卫星图像发现了这些岛屿,但只是在近年8月和9月的一次考察中确认并绘制了地图。  这些新岛屿位于北极Vylki冰川附近,远离遥远的新地马岛群岛海岸,该群岛位于俄罗斯大陆西北的北冰洋。它们的面积从900平方米到54500平方米不等。据俄罗斯塔斯社报道,俄探险队队长亚历山大·莫伊斯耶夫22日表示:“基本上,这一发现与冰川融化有关。”“以前这些是冰川,但冰的融化导致了岛屿的出现。”俄罗斯国防部称,俄罗斯海军研究人员多年来一直使用卫星数据来研究海岸线的变化。2015年至2018年期间,他们确认了新地岛(Novaya Zemlya)和弗朗茨约瑟夫岛(Franz Josef Land)两个群岛上的30多个新岛屿、海角和海湾。科学家们警告说,新出现的岛屿不是“意外”,而是北极冰川和海冰大规模融化导致的日益严重的气候危机的直接结果。据悉,北极的升温速度是全球平均水平的两倍,由此导致的冰川融化可能会破坏生命周期,并威胁到全球各地人们的生命。",
311
+      "content": "",
312
+      "is_liked": false,
313
+      "likes": 0,
314
+      "reads": 0,
315
+      "shares": 0,
316
+      "is_favorited": false,
317
+      "favorites": 0,
318
+      "comment_count": 1,
319
+      "last_comment": {
320
+        "id": "5db31b191f3bf31bb0031dad",
321
+        "nickname": "Adam的测试",
322
+        "avatar": "https://links123-images.oss-cn-hangzhou.aliyuncs.com/avatar/2019/4/12/b705c964fdef980ac9b719f1973f7b75.jpg",
323
+        "introduction": "是你的哈哈哈订单是你的哈哈哈订单是你的哈哈哈订单是你的哈哈哈哈哈哈订单是你哈哈订单是你哈哈哈订单是你的哈是你的哈哈哈订单哈哈订单是你的哈哈哈订单是你的哈哈哈订单是你的哈哈哈订单是你的哈哈哈订单是你的哈哈哈订单是你的哈哈哈订单是你的哈哈哈订单是你的哈哈哈订单是你的哈哈哈订单是你的哈哈哈订单是你的哈哈哈订单是你的哈哈哈订单是你的哈哈哈订单是你的哈哈哈订单是你的哈哈哈订单是你的哈哈哈订单是你的哈哈哈订单是你的哈哈哈订单是你的哈哈哈订单是你的哈哈哈订单是你的哈哈哈订单是你的哈哈哈订单是你的哈哈哈订单是你的哈哈哈订单是你的哈哈哈订单是你的哈哈哈订单是你的哈哈哈订单是你的哈哈哈订单是你的哈哈哈订单是你的哈哈哈订单是你的哈哈哈订单是你的哈哈哈订单",
324
+        "followed": 0,
325
+        "invited": false,
326
+        "fans": 0,
327
+        "follows": 0,
328
+        "user_id": 45,
329
+        "type": 4,
330
+        "model_id": "5db305cacd9c3400015a1db4",
331
+        "model_type": "question",
332
+        "related_id": "5db31b191f3bf31bb0031dad",
333
+        "content": "\u003cp\u003e''11111\u003c/p\u003e",
334
+        "content_text": "''11111",
335
+        "is_liked": false,
336
+        "is_favorited": false,
337
+        "favorites": 0,
338
+        "likes": 2,
339
+        "shares": 4,
340
+        "reads": 0,
341
+        "comment_count": 2,
342
+        "created": 1572018969,
343
+        "updated": 1572018969,
344
+        "question_title": "",
345
+        "assets": [],
346
+        "is_top": false,
347
+        "anonymity": false,
348
+        "deleted": 0,
349
+        "my_comment": {
350
+          "id": "5db31b191f3bf31bb0031dad",
351
+          "content": "测试",
352
+          "created": 1572172386
353
+        },
354
+        "read_times": 66,
355
+        "sort_score": 0,
356
+        "tip_num": 0,
357
+        "paid_money": 0
358
+      },
359
+      "my_comment": {
360
+        "id": "",
361
+        "nickname": "",
362
+        "avatar": "",
363
+        "introduction": "",
364
+        "followed": 0,
365
+        "invited": false,
366
+        "fans": 0,
367
+        "follows": 0,
368
+        "user_id": 0,
369
+        "type": 0,
370
+        "model_id": "",
371
+        "model_type": "",
372
+        "related_id": "",
373
+        "content": "",
374
+        "content_text": "",
375
+        "is_liked": false,
376
+        "is_favorited": false,
377
+        "favorites": 0,
378
+        "likes": 0,
379
+        "shares": 0,
380
+        "reads": 0,
381
+        "comment_count": 0,
382
+        "created": 0,
383
+        "updated": 0,
384
+        "question_title": "",
385
+        "assets": null,
386
+        "is_top": false,
387
+        "anonymity": false,
388
+        "deleted": 0,
389
+        "my_comment": {
390
+          "id": "",
391
+          "content": "",
392
+          "created": 0
393
+        },
394
+        "read_times": 0,
395
+        "sort_score": 0,
396
+        "tip_num": 0,
397
+        "paid_money": 0
398
+      },
399
+      "draft": {
400
+        "nickname": "",
401
+        "avatar": "",
402
+        "introduction": "",
403
+        "followed": 0,
404
+        "invited": false,
405
+        "fans": 0,
406
+        "follows": 0,
407
+        "id": "",
408
+        "user_id": 0,
409
+        "model_id": "",
410
+        "model_type": "",
411
+        "content": "",
412
+        "title": "",
413
+        "pure_content": "",
414
+        "content_type": "",
415
+        "created": 0,
416
+        "updated": 0,
417
+        "topic": null,
418
+        "is_long": false,
419
+        "assets": null
420
+      },
421
+      "assets": [],
422
+      "is_featured": false,
423
+      "labels": [
424
+        {
425
+          "id": "5db305bdcd9c3400015a1db1",
426
+          "text": "常识",
427
+          "question_num": 0
428
+        },
429
+        {
430
+          "id": "5db305c3cd9c3400015a1db2",
431
+          "text": "百科",
432
+          "question_num": 0
433
+        },
434
+        {
435
+          "id": "5db305c6cd9c3400015a1db3",
436
+          "text": "综合",
437
+          "question_num": 0
438
+        }
439
+      ],
440
+      "anonymity": true,
441
+      "invite_users": null,
442
+      "deleted": 0,
443
+      "created": 1572013514,
444
+      "tip_num": 0,
445
+      "is_reward": false,
446
+      "money": 0
447
+    },
448
+    {
449
+      "id": "5db162bdcd9c3400015a18be",
450
+      "nickname": "Chris",
451
+      "avatar": "https://links123-images.oss-cn-hangzhou.aliyuncs.com/avatar/2019/11/9/ed4f0b88b6a1aed7fce41432e47d6ba3.jpg",
452
+      "introduction": "",
453
+      "followed": 0,
454
+      "invited": false,
455
+      "fans": 0,
456
+      "follows": 0,
457
+      "user_id": 5,
458
+      "title": "下午好",
459
+      "content": "",
460
+      "is_liked": false,
461
+      "likes": 0,
462
+      "reads": 0,
463
+      "shares": 0,
464
+      "is_favorited": false,
465
+      "favorites": 0,
466
+      "comment_count": 2,
467
+      "last_comment": {
468
+        "id": "5db1d787cd9c3400015a192f",
469
+        "nickname": "L99193",
470
+        "avatar": "https://links123-images.oss-cn-hangzhou.aliyuncs.com/avatar/2018/12/14/0d5b1c4c7f720f698946c7f6ab08f687.jpg",
471
+        "introduction": "",
472
+        "followed": 0,
473
+        "invited": false,
474
+        "fans": 0,
475
+        "follows": 0,
476
+        "user_id": 71675,
477
+        "type": 4,
478
+        "model_id": "5db162bdcd9c3400015a18be",
479
+        "model_type": "question",
480
+        "related_id": "5db1d787cd9c3400015a192f",
481
+        "content": "123",
482
+        "content_text": "123",
483
+        "is_liked": true,
484
+        "is_favorited": false,
485
+        "favorites": 0,
486
+        "likes": 1,
487
+        "shares": 3,
488
+        "reads": 0,
489
+        "comment_count": 1,
490
+        "created": 1571936135,
491
+        "updated": 1571936135,
492
+        "question_title": "",
493
+        "assets": [],
494
+        "is_top": false,
495
+        "anonymity": false,
496
+        "deleted": 0,
497
+        "my_comment": {
498
+          "id": "5db1d787cd9c3400015a192f",
499
+          "content": "转发同时发布评论",
500
+          "created": 1572011648
501
+        },
502
+        "read_times": 66,
503
+        "sort_score": 0,
504
+        "tip_num": 1,
505
+        "paid_money": 0
506
+      },
507
+      "my_comment": {
508
+        "id": "",
509
+        "nickname": "",
510
+        "avatar": "",
511
+        "introduction": "",
512
+        "followed": 0,
513
+        "invited": false,
514
+        "fans": 0,
515
+        "follows": 0,
516
+        "user_id": 0,
517
+        "type": 0,
518
+        "model_id": "",
519
+        "model_type": "",
520
+        "related_id": "",
521
+        "content": "",
522
+        "content_text": "",
523
+        "is_liked": false,
524
+        "is_favorited": false,
525
+        "favorites": 0,
526
+        "likes": 0,
527
+        "shares": 0,
528
+        "reads": 0,
529
+        "comment_count": 0,
530
+        "created": 0,
531
+        "updated": 0,
532
+        "question_title": "",
533
+        "assets": null,
534
+        "is_top": false,
535
+        "anonymity": false,
536
+        "deleted": 0,
537
+        "my_comment": {
538
+          "id": "",
539
+          "content": "",
540
+          "created": 0
541
+        },
542
+        "read_times": 0,
543
+        "sort_score": 0,
544
+        "tip_num": 0,
545
+        "paid_money": 0
546
+      },
547
+      "draft": {
548
+        "nickname": "",
549
+        "avatar": "",
550
+        "introduction": "",
551
+        "followed": 0,
552
+        "invited": false,
553
+        "fans": 0,
554
+        "follows": 0,
555
+        "id": "",
556
+        "user_id": 0,
557
+        "model_id": "",
558
+        "model_type": "",
559
+        "content": "",
560
+        "title": "",
561
+        "pure_content": "",
562
+        "content_type": "",
563
+        "created": 0,
564
+        "updated": 0,
565
+        "topic": null,
566
+        "is_long": false,
567
+        "assets": null
568
+      },
569
+      "assets": [
570
+        {
571
+          "type": "img",
572
+          "url": "https://links123-images.oss-cn-hangzhou.aliyuncs.com/question/2019/10/24/3a3f52bec83b347ad3b8f0a9a3a95714.jpg",
573
+          "width": 720,
574
+          "height": 1280
575
+        }
576
+      ],
577
+      "is_featured": false,
578
+      "labels": [],
579
+      "anonymity": false,
580
+      "invite_users": null,
581
+      "deleted": 0,
582
+      "created": 1571906237,
583
+      "tip_num": 0,
584
+      "is_reward": false,
585
+      "money": 0
586
+    },
587
+    {
588
+      "id": "5db2e7cacd9c3400015a1b70",
589
+      "nickname": "Anonymous",
590
+      "avatar": "https://links-comment.oss-cn-beijing.aliyuncs.com/comment/20180820/Kgka4_oU1.jpeg",
591
+      "introduction": "",
592
+      "followed": 0,
593
+      "invited": false,
594
+      "fans": 0,
595
+      "follows": 0,
596
+      "user_id": 58297,
597
+      "title": "2019年10月24日报道,综合报道,全球变暖可能正改变北极的地貌!俄罗斯国防部日前表示,俄海军在北极发现了5座新岛屿,正是冰川融化导致了这几座岛屿显露出来。 俄国防部表示,俄海军在2016年首次利用卫星图像发现了这些岛屿,但只是在近年8月和9月的一次考察中确认并绘制了地图。 这些新岛屿位于北极Vylki冰川附近,远离遥远的新地马岛群岛海岸,该群岛位于俄罗斯大陆西北的北冰洋。米到54500平方米不等。",
598
+      "content": "",
599
+      "is_liked": false,
600
+      "likes": 0,
601
+      "reads": 0,
602
+      "shares": 0,
603
+      "is_favorited": false,
604
+      "favorites": 0,
605
+      "comment_count": 2,
606
+      "last_comment": {
607
+        "id": "5db2e7d1cd9c3400015a1b72",
608
+        "nickname": "异想天开的喵(^・ェ・^)",
609
+        "avatar": "https://links123-images.oss-cn-hangzhou.aliyuncs.com/avatar/2019/5/27/b3ba4371dd24c64b48475b8020370790.jpg",
610
+        "introduction": "",
611
+        "followed": 0,
612
+        "invited": false,
613
+        "fans": 0,
614
+        "follows": 0,
615
+        "user_id": 58297,
616
+        "type": 4,
617
+        "model_id": "5db2e7cacd9c3400015a1b70",
618
+        "model_type": "question",
619
+        "related_id": "5db2e7d1cd9c3400015a1b72",
620
+        "content": "\u003cp\u003e\u003cspan\u003e2019年10月24日报道,综合报道,全球变暖可能正改变北极的地貌!俄罗斯国防部日前表示,俄海军在北极发现了5座新岛屿,正是冰川融化导致了这几座岛屿显露出来。 俄国防部表示,俄海军在2016年首次利用卫星图像发现了这些岛屿,但只是在近年8月和9月的一次考察中确认并绘制了地图。 这些新岛屿位于北极Vylki冰川附近,远离遥远的新地马岛群岛海岸,该群岛位于俄罗斯大陆西北的北冰洋。它们的面积从900平方米到54500平方米不等。\u003c/span\u003e\u003c/p\u003e",
621
+        "content_text": "2019年10月24日报道,综合报道,全球变暖可能正改变北极的地貌!俄罗斯国防部日前表示,俄海军在北极发现了5座新岛屿,正是冰川融化导致了这几座岛屿显露出来。 俄国防部表示,俄海军在2016年首次利用卫星图像发现了这些岛屿,但只是在近年8月和9月的一次考察中确认并绘制了地图。 这些新岛屿位于北极Vylki冰川附近,远离遥远的新地马岛群岛海岸,该群岛位于俄罗斯大陆西北的北冰洋。它们的面积从900平方米到54500平方米不等。",
622
+        "is_liked": true,
623
+        "is_favorited": true,
624
+        "favorites": 1,
625
+        "likes": 1,
626
+        "shares": 2,
627
+        "reads": 0,
628
+        "comment_count": 2,
629
+        "created": 1572005841,
630
+        "updated": 1572005841,
631
+        "question_title": "",
632
+        "assets": [],
633
+        "is_top": false,
634
+        "anonymity": false,
635
+        "deleted": 0,
636
+        "my_comment": {
637
+          "id": "5db2e7d1cd9c3400015a1b72",
638
+          "content": "ceshi ",
639
+          "created": 1572010175
640
+        },
641
+        "read_times": 146,
642
+        "sort_score": 0,
643
+        "tip_num": 0,
644
+        "paid_money": 0
645
+      },
646
+      "my_comment": {
647
+        "id": "",
648
+        "nickname": "",
649
+        "avatar": "",
650
+        "introduction": "",
651
+        "followed": 0,
652
+        "invited": false,
653
+        "fans": 0,
654
+        "follows": 0,
655
+        "user_id": 0,
656
+        "type": 0,
657
+        "model_id": "",
658
+        "model_type": "",
659
+        "related_id": "",
660
+        "content": "",
661
+        "content_text": "",
662
+        "is_liked": false,
663
+        "is_favorited": false,
664
+        "favorites": 0,
665
+        "likes": 0,
666
+        "shares": 0,
667
+        "reads": 0,
668
+        "comment_count": 0,
669
+        "created": 0,
670
+        "updated": 0,
671
+        "question_title": "",
672
+        "assets": null,
673
+        "is_top": false,
674
+        "anonymity": false,
675
+        "deleted": 0,
676
+        "my_comment": {
677
+          "id": "",
678
+          "content": "",
679
+          "created": 0
680
+        },
681
+        "read_times": 0,
682
+        "sort_score": 0,
683
+        "tip_num": 0,
684
+        "paid_money": 0
685
+      },
686
+      "draft": {
687
+        "nickname": "",
688
+        "avatar": "",
689
+        "introduction": "",
690
+        "followed": 0,
691
+        "invited": false,
692
+        "fans": 0,
693
+        "follows": 0,
694
+        "id": "",
695
+        "user_id": 0,
696
+        "model_id": "",
697
+        "model_type": "",
698
+        "content": "",
699
+        "title": "",
700
+        "pure_content": "",
701
+        "content_type": "",
702
+        "created": 0,
703
+        "updated": 0,
704
+        "topic": null,
705
+        "is_long": false,
706
+        "assets": null
707
+      },
708
+      "assets": [],
709
+      "is_featured": false,
710
+      "labels": [],
711
+      "anonymity": true,
712
+      "invite_users": null,
713
+      "deleted": 0,
714
+      "created": 1572005834,
715
+      "tip_num": 0,
716
+      "is_reward": false,
717
+      "money": 0
718
+    }
719
+  ],
720
+  "page": 1,
721
+  "limit": 5,
722
+  "total": 26
723
+}

+ 292
- 0
stories/index.stories.tsx View File

@@ -0,0 +1,292 @@
1
+import React from 'react';
2
+import { storiesOf } from '@storybook/react';
3
+import { action } from '@storybook/addon-actions';
4
+import { withInfo } from "@storybook/addon-info";
5
+import { withKnobs, number, boolean, select } from "@storybook/addon-knobs";
6
+import { addReadme } from 'storybook-readme';
7
+
8
+import ConsumeListView from '@components/Payment/Common/ConsumeListView';
9
+import ConsumeListViewDoc from '@components/Payment/Common/ConsumeListView/README.md';
10
+import PayPlatFormOptions, { PAY_CHANNEL } from '@components/Payment/Common/PayPlatformOptions/index';
11
+import PayPlatFormOptionsDoc from '@components/Payment/Common/PayPlatformOptions/README.md';
12
+import PriceOptions from '@components/Payment/Common/PriceOptions';
13
+import PriceOptionsDoc from '@components/Payment/Common/PriceOptions/README.md';
14
+import WaitPayInfoView from '@components/Payment/Common/WaitPayInfoView';
15
+import WaitPayInfoViewDoc from '@components/Payment/Common/WaitPayInfoView/README.md';
16
+
17
+const stories = storiesOf('Payment', module);
18
+stories.addDecorator((storyFn) => <div style={{padding: "0px 40px"}}>{storyFn()}</div>)
19
+stories.addDecorator(withKnobs);
20
+stories.addDecorator(withInfo);
21
+stories.addDecorator(addReadme);
22
+
23
+const consumeData = [
24
+  {
25
+    "id": 69,
26
+    "consume_id": "20190919120838283305719",
27
+    "goods_id": 0,
28
+    "goods_type": 4,
29
+    "num": 9,
30
+    "user_id": 71082,
31
+    "user_nickname": "lydia",
32
+    "user_avatar": "https://links123-images.oss-cn-hangzhou.aliyuncs.com/avatar/2018/8/26/10adf03c70fb128d546e0d40fea77047.jpg",
33
+    "to_user_id": 1,
34
+    "to_user_nickname": "",
35
+    "to_user_avatar": "",
36
+    "bill_price": 900,
37
+    "ref_id": 0,
38
+    "business_type": 3,
39
+    "created_at": 1568894918,
40
+    "updated_at": 1568894918
41
+  },
42
+  {
43
+    "id": 32,
44
+    "consume_id": "20190802095658644217897",
45
+    "goods_id": 2,
46
+    "goods_type": 1,
47
+    "num": 8,
48
+    "user_id": 2,
49
+    "user_nickname": "jim",
50
+    "user_avatar": "https://links123-images.oss-cn-hangzhou.aliyuncs.com/avatar/2018/4/6/7d4948f6e9a66789f776b0c69c8d51d9.png",
51
+    "to_user_id": 1,
52
+    "to_user_nickname": "",
53
+    "to_user_avatar": "",
54
+    "bill_price": 800,
55
+    "ref_id": 0,
56
+    "business_type": 3,
57
+    "created_at": 1564739818,
58
+    "updated_at": 1564739818
59
+  },
60
+  {
61
+    "id": 46,
62
+    "consume_id": "20190819131433734083448",
63
+    "goods_id": 2,
64
+    "goods_type": 1,
65
+    "num": 7,
66
+    "user_id": 5,
67
+    "user_nickname": "Chris",
68
+    "user_avatar": "https://links123-images.oss-cn-hangzhou.aliyuncs.com/avatar/2019/6/12/a1aec180fbb727cc693c7a2f14812dac.jpg",
69
+    "to_user_id": 1,
70
+    "to_user_nickname": "",
71
+    "to_user_avatar": "",
72
+    "bill_price": 700,
73
+    "ref_id": 0,
74
+    "business_type": 3,
75
+    "created_at": 1566220473,
76
+    "updated_at": 1566220473
77
+  },
78
+  {
79
+    "id": 20,
80
+    "consume_id": "20190729154830503859957",
81
+    "goods_id": 2,
82
+    "goods_type": 1,
83
+    "num": 5,
84
+    "user_id": 217,
85
+    "user_nickname": "Paul",
86
+    "user_avatar": "https://links123-images.oss-cn-hangzhou.aliyuncs.com/avatar/2019/12/4/b9221e3176d92c349affc3633a0ec7bf.jpg",
87
+    "to_user_id": 1,
88
+    "to_user_nickname": "",
89
+    "to_user_avatar": "",
90
+    "bill_price": 500,
91
+    "ref_id": 0,
92
+    "business_type": 3,
93
+    "created_at": 1564415310,
94
+    "updated_at": 1564415310
95
+  },
96
+  {
97
+    "id": 127,
98
+    "consume_id": "20191204115927765695546",
99
+    "goods_id": 2,
100
+    "goods_type": 1,
101
+    "num": 1,
102
+    "user_id": 45,
103
+    "user_nickname": "Adam",
104
+    "user_avatar": "https://links123-images.oss-cn-hangzhou.aliyuncs.com/avatar/2019/6/12/cbc5208e3a8aba6fcfc2cef2a4d5151d.jpg",
105
+    "to_user_id": 1,
106
+    "to_user_nickname": "",
107
+    "to_user_avatar": "",
108
+    "bill_price": 100,
109
+    "ref_id": 0,
110
+    "business_type": 3,
111
+    "created_at": 1575460767,
112
+    "updated_at": 1575460767
113
+  },
114
+  {
115
+    "id": 71,
116
+    "consume_id": "20190922010906704921621",
117
+    "goods_id": 0,
118
+    "goods_type": 4,
119
+    "num": 1,
120
+    "user_id": 22428,
121
+    "user_nickname": "简单生活",
122
+    "user_avatar": "https://links123-images.oss-cn-hangzhou.aliyuncs.com/avatar/2019/9/22/27886bb4305ab56adc0b20018b975dc5.jpg",
123
+    "to_user_id": 1,
124
+    "to_user_nickname": "",
125
+    "to_user_avatar": "",
126
+    "bill_price": 100,
127
+    "ref_id": 0,
128
+    "business_type": 3,
129
+    "created_at": 1569114546,
130
+    "updated_at": 1569114546
131
+  },
132
+  {
133
+    "id": 70,
134
+    "consume_id": "20190920014118872836942",
135
+    "goods_id": 0,
136
+    "goods_type": 4,
137
+    "num": 1,
138
+    "user_id": 70406,
139
+    "user_nickname": "vicky",
140
+    "user_avatar": "https://links123-images.oss-cn-hangzhou.aliyuncs.com/avatar/2019/5/5/8a0db661919f926501192eccf13740f1jpg",
141
+    "to_user_id": 1,
142
+    "to_user_nickname": "",
143
+    "to_user_avatar": "",
144
+    "bill_price": 100,
145
+    "ref_id": 0,
146
+    "business_type": 3,
147
+    "created_at": 1568943678,
148
+    "updated_at": 1568943678
149
+  },
150
+  {
151
+    "id": 68,
152
+    "consume_id": "20190917224355248346157",
153
+    "goods_id": 0,
154
+    "goods_type": 4,
155
+    "num": 1,
156
+    "user_id": 71603,
157
+    "user_nickname": "Slate",
158
+    "user_avatar": "https://links123-images.oss-cn-hangzhou.aliyuncs.com/avatar/2019/10/19/1cb9f491e90258ba91a189027ef774b7.jpg",
159
+    "to_user_id": 1,
160
+    "to_user_nickname": "",
161
+    "to_user_avatar": "",
162
+    "bill_price": 100,
163
+    "ref_id": 0,
164
+    "business_type": 3,
165
+    "created_at": 1568760235,
166
+    "updated_at": 1568760235
167
+  }
168
+];
169
+
170
+stories.add(
171
+  'ConsumeListView',
172
+  () => {
173
+    const [toggle, setToggle] = React.useState(false);
174
+    return <ConsumeListView
175
+      isToggle={toggle}
176
+      onToggleChange={() => setToggle(!toggle)}
177
+      dataSource={consumeData}
178
+      listLength={consumeData.length}
179
+      showLength={number("showLength", 5)}
180
+    />
181
+  },
182
+  {
183
+    info: {
184
+      inline: true,
185
+      text: `
186
+      ~~~typescript
187
+      <ConsumeListView
188
+        isToggle={toggle}
189
+        onToggleChange={() => setToggle(!toggle)}
190
+        dataSource={consumeData}
191
+        listLength={consumeData.length}
192
+        showLength={number("showLength", 5)}
193
+      />
194
+      ~~~
195
+      `,
196
+      // TableComponent: (props: TableComponentOptionProps) => {
197
+      //   const { propDefinitions } = props;
198
+      //   return propDefinitions.map(i => {
199
+      //     return (
200
+      //       <div>
201
+      //         {i.defaultValue}
202
+      //       </div>
203
+      //     )
204
+      //   })
205
+      // },
206
+      source: false,
207
+      maxPropStringLength: 500,
208
+    },
209
+    notes: 'A very simple example of addon notes',
210
+    readme: {
211
+      sidebar: ConsumeListViewDoc,
212
+    }
213
+  }
214
+);
215
+
216
+stories.add(
217
+  'PayPlatFormOptions',
218
+  () => {
219
+    const [payitem, setPayitem] = React.useState(PAY_CHANNEL.PAYPAL);
220
+    return (
221
+      <PayPlatFormOptions
222
+        payitem={payitem}
223
+        onPayItemChange={(value) => {
224
+          action(`PayItemChange: ${value}`);
225
+          setPayitem(value);
226
+        }}
227
+        isMobile={boolean("isMobile", false)}
228
+        size={select("size", { Small: "small", Normal: "normal", Large: "large"}, "normal")}
229
+        withTitle={boolean("withTitle", false)}
230
+        locale={select("locale", { ZH: 'zh', EN: 'en' }, "zh")}
231
+      />
232
+    )
233
+  },
234
+  {
235
+    info: {
236
+      inline: true,
237
+      text: ``,
238
+      source: false,
239
+      maxPropStringLength: 500,
240
+    },
241
+    notes: 'A very simple example of addon notes',
242
+    readme: {
243
+      sidebar: PayPlatFormOptionsDoc,
244
+    }
245
+  }
246
+);
247
+
248
+stories.add(
249
+  'PriceOptions',
250
+  () => {
251
+    const [price, setPrice] = React.useState(0);
252
+    const refInput = React.useRef(null);
253
+    return (
254
+      <PriceOptions
255
+        price={price}
256
+        onPriceChange={(v) => setPrice(v)}
257
+        size={select("size", { Small: "small", Normal: "normal", Large: "large"}, "normal")}
258
+        withTitle={boolean("withTitle", false)}
259
+        focusScroll={boolean("focusScroll", false)}
260
+        inputRef={refInput}
261
+      />
262
+    )
263
+  },
264
+  {
265
+    info: {
266
+      inline: true,
267
+      text: ``,
268
+      source: false,
269
+      maxPropStringLength: 500,
270
+    },
271
+    notes: 'A very simple example of addon notes',
272
+    readme: {
273
+      sidebar: PriceOptionsDoc,
274
+    }
275
+  }
276
+)
277
+
278
+stories.add(
279
+  'WaitPayInfoView',
280
+  () => {
281
+    return (
282
+      <WaitPayInfoView />
283
+    )
284
+  },
285
+  {
286
+    info: { inline: true, text: ``, source: false, maxPropStringLength: 500 },
287
+    notes: 'A very simple example of addon notes',
288
+    readme: {
289
+      sidebar: WaitPayInfoViewDoc,
290
+    }
291
+  }
292
+)

+ 8
- 3
tsconfig.json View File

@@ -1,6 +1,10 @@
1 1
 {
2 2
   "compilerOptions": {
3 3
     "target": "es5",
4
+    "rootDirs": [
5
+      "src",
6
+      "stories"
7
+    ],
4 8
     "lib": [
5 9
       "dom",
6 10
       "dom.iterable",
@@ -15,16 +19,17 @@
15 19
     "module": "esnext",
16 20
     "moduleResolution": "node",
17 21
     "resolveJsonModule": true,
18
-    // "isolatedModules": true,
22
+    "isolatedModules": true,
19 23
     "noEmit": true,
20 24
     "jsx": "react"
21 25
   },
22 26
   "baseUrl": ".",
23 27
   "paths": {
24
-    "@/*": ["*"],
28
+    "@/*": ["src/*"],
25 29
     "@components/*": [ "src/components/*" ]
26 30
   },
27 31
   "include": [
28
-    "src"
32
+    "src/**/*",
33
+    "stories/**/*"
29 34
   ]
30 35
 }

+ 3451
- 98
yarn.lock
File diff suppressed because it is too large
View File