File tree Expand file tree Collapse file tree 1 file changed +14
-1
lines changed Expand file tree Collapse file tree 1 file changed +14
-1
lines changed Original file line number Diff line number Diff line change @@ -57,6 +57,18 @@ const darkStyle = {
5757stories . addDecorator ( ( story , context ) => withInfo ( 'Details' ) ( story ) ( context ) ) ;
5858stories . addDecorator ( withKnobs ) ;
5959
60+ // Component for With Reset story
61+ function WithReset ( ) {
62+ const [ value , setValue ] = React . useState ( null ) ;
63+
64+ return (
65+ < React . Fragment >
66+ < ReactCodeInput onChange = { ( ) => setValue ( null ) } value = { value } />
67+ < button style = { { ...inputStyle , width : 'auto' , backgroundColor : 'lightgray' } } onClick = { ( ) => setValue ( '' ) } > Reset</ button >
68+ </ React . Fragment >
69+ )
70+ }
71+
6072// Stories for Input Field
6173stories
6274 . add (
@@ -72,7 +84,8 @@ stories
7284 . add (
7385 'Force Uppercase' , ( ) =>
7486 < CodeInputField fields = { 4 } type = "text" forceUppercase value = "test" onChange = { action ( 'onChange' ) } />
75- ) ;
87+ )
88+ . add ( 'With Reset' , WithReset ) ;
7689
7790// Creation of Props
7891propVariantStories . addDecorator ( ( story , context ) => withInfo ( 'Details' ) ( story ) ( context ) ) ;
You can’t perform that action at this time.
0 commit comments