Browse Source

test: fix import miss in pincode story

pointhalo 1 year ago
parent
commit
71984f156d
1 changed files with 41 additions and 23 deletions
  1. 41 23
      packages/semi-ui/pincode/_story/pincode.stories.js

+ 41 - 23
packages/semi-ui/pincode/_story/pincode.stories.js

@@ -1,34 +1,52 @@
-import React,{useState} from 'react';
+import React, { useState, useRef } from 'react';
 import PinCode from '../index';
 
 export default {
-    title: 'PinCode'
-}
+    title: 'PinCode',
+};
 
 export const PinCodeBasic = () => (
     <>
-      <PinCode size={'small'} onComplete={v=>alert(v)} onChange={v=>{
-          console.log(v)
-      }}/>
-        <PinCode size={'default'} onComplete={v=>alert(v)} onChange={v=>{
-            console.log(v)
-        }}/>
-        <PinCode size={'large'} onComplete={v=>alert(v)} onChange={v=>{
-            console.log(v)
-        }}/>
+        <PinCode
+            size={'small'}
+            onComplete={v => alert(v)}
+            onChange={v => {
+                console.log(v);
+            }}
+        />
+        <PinCode
+            size={'default'}
+            onComplete={v => alert(v)}
+            onChange={v => {
+                console.log(v);
+            }}
+        />
+        <PinCode
+            size={'large'}
+            onComplete={v => alert(v)}
+            onChange={v => {
+                console.log(v);
+            }}
+        />
     </>
 );
 
 export const PinCodeControl = () => {
-    const [value,setValue] = useState("123");
+    const [value, setValue] = useState('123');
     const ref = useRef();
-    return <>
-        <button onClick={()=>ref.current.focus(2)}>focus third</button>
-        <PinCode format={"mixed"}  ref={ref}
-                 onComplete={value=>console.log("pincode: ",value)}
-                 value={value} onChange={v=>{
-            console.log(v)
-            setValue(v)
-        }}/>
-    </>
-}
+    return (
+        <>
+            <button onClick={() => ref.current.focus(2)}>focus third</button>
+            <PinCode
+                format={'mixed'}
+                ref={ref}
+                onComplete={value => console.log('pincode: ', value)}
+                value={value}
+                onChange={v => {
+                    console.log(v);
+                    setValue(v);
+                }}
+            />
+        </>
+    );
+};