File tree Expand file tree Collapse file tree 5 files changed +19
-9
lines changed
src/components/data-container/step-box
stories/components/data-container Expand file tree Collapse file tree 5 files changed +19
-9
lines changed Original file line number Diff line number Diff line change 1
1
{
2
2
"name" : " tksui-components" ,
3
- "version" : " 0.9.1 " ,
3
+ "version" : " 0.9.2 " ,
4
4
"private" : false ,
5
5
"type" : " module" ,
6
6
"module" : " lib/esm/index.js" ,
Original file line number Diff line number Diff line change @@ -12,6 +12,7 @@ const TStepBox = ({
12
12
nextButtonLabel = 'Next' ,
13
13
completeButtonLabel = 'Complete' ,
14
14
value,
15
+ onChange,
15
16
children,
16
17
style,
17
18
className,
@@ -24,6 +25,7 @@ const TStepBox = ({
24
25
nextButtonLabel,
25
26
completeButtonLabel,
26
27
value,
28
+ onChange,
27
29
children,
28
30
style,
29
31
className,
@@ -43,11 +45,12 @@ const TStepBox = ({
43
45
let content = null ;
44
46
45
47
if ( children ?. length === undefined ) {
48
+ // children 안 들어옴
46
49
if ( ! children ) {
47
- // children 안들어옴
48
50
return null ;
49
51
}
50
- content = children ; // children 1개
52
+ // children 1개
53
+ content = children ;
51
54
} else {
52
55
// children 2개 이상
53
56
content = children [ value - 1 ] ;
Original file line number Diff line number Diff line change @@ -16,7 +16,7 @@ type stepBoxContext = {
16
16
export const tabBoxContext = createContext < stepBoxContext > ( {
17
17
totalStep : 0 ,
18
18
currentStep : 0 ,
19
- onChangeCurrentStep : null ,
19
+ onChangeCurrentStep : ( ) => { } ,
20
20
prevButtonLabel : '' ,
21
21
nextButtonLabel : '' ,
22
22
completeButtonLabel : '' ,
Original file line number Diff line number Diff line change @@ -16,8 +16,12 @@ type Story = StoryObj<typeof TStepBox>;
16
16
const Template = ( args ) => {
17
17
const [ stepNumber , setStepNumber ] = useState < number > ( 1 ) ;
18
18
19
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
20
+ const { onChange, ...restArgs } = args ;
21
+
19
22
return (
20
23
< >
24
+ { stepNumber }
21
25
< TStepBox
22
26
value = { stepNumber }
23
27
onChange = { setStepNumber }
@@ -29,7 +33,7 @@ const Template = (args) => {
29
33
'정책 선택' ,
30
34
'확인 및 생성' ,
31
35
] }
32
- { ...args }
36
+ { ...restArgs }
33
37
>
34
38
< TStepBoxItem contentDirection = { 'top-bottom' } >
35
39
< div > Step 1-1 Content</ div >
@@ -68,7 +72,7 @@ const Template = (args) => {
68
72
'정책 선택' ,
69
73
'확인 및 생성' ,
70
74
] }
71
- { ...args }
75
+ { ...restArgs }
72
76
>
73
77
< TStepBoxItem contentDirection = { 'left-right' } >
74
78
< div > Step 1-1 Content</ div >
Original file line number Diff line number Diff line change 1
1
import type { Meta , StoryObj } from '@storybook/react' ;
2
+ import { useState } from 'react' ;
2
3
3
- import useInputState from '@/common/hook/UseInputState' ;
4
4
import TTabBox from '@/components/data-container/tab-box/TTabBox' ;
5
5
import type { TTabBoxValue } from '@/components/data-container/tab-box/TTabBox.interface' ;
6
6
import TTabItem from '@/components/data-container/tab-box/TTabItem' ;
@@ -15,11 +15,14 @@ export default meta;
15
15
type Story = StoryObj < typeof TTabBox > ;
16
16
17
17
const Template = ( args ) => {
18
- const tab = useInputState < TTabBoxValue > ( 0 ) ;
18
+ const [ tab , setTab ] = useState < TTabBoxValue > ( 0 ) ;
19
+
20
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
21
+ const { onChange, ...restArgs } = args ;
19
22
20
23
return (
21
24
< >
22
- < TTabBox { ... tab } { ...args } >
25
+ < TTabBox value = { tab } onChange = { setTab } { ...restArgs } >
23
26
< TTabItem label = { 'One' } content = { < div > Tab One</ div > } />
24
27
< TTabItem label = { 'Two' } content = { < div > Tab Two</ div > } />
25
28
< TTabItem label = { 'Three' } content = { < div > Tab Three</ div > } />
You can’t perform that action at this time.
0 commit comments