@@ -2,10 +2,10 @@ import { Title, Subtitle, Description, Controls, Primary, Markdown } from '@stor
2
2
import { useArgs } from '@storybook/client-api' ;
3
3
import React from 'react' ;
4
4
5
- import Readme from '../../ packages/css/src/stepper/README.md' ;
6
- import MdButton from '../../ packages/react/src/button/MdButton' ;
7
- import MdStep from '../../ packages/react/src/stepper/MdStep' ;
8
- import MdStepper from '../../ packages/react/src/stepper/MdStepper' ;
5
+ import Readme from '../packages/css/src/stepper/README.md' ;
6
+ import MdButton from '../packages/react/src/button/MdButton' ;
7
+ import MdStep from '../packages/react/src/stepper/MdStep' ;
8
+ import MdStepper from '../packages/react/src/stepper/MdStepper' ;
9
9
import type { Args , StoryFn } from '@storybook/react' ;
10
10
11
11
export default {
@@ -27,7 +27,7 @@ export default {
27
27
} ,
28
28
description : {
29
29
// eslint-disable-next-line quotes
30
- component : "Stepper component.<br/><br/>`import { MdStepper } from '@miljodirektoratet/md-react'`" ,
30
+ component : "Stepper component.<br/><br/>`import { MdStepper, MdStep } from '@miljodirektoratet/md-react'`" ,
31
31
} ,
32
32
} ,
33
33
} ,
@@ -53,9 +53,101 @@ export default {
53
53
} ,
54
54
control : { type : 'ReactNode' } ,
55
55
} ,
56
+ MdStep_title : {
57
+ type : { name : 'string' } ,
58
+ description : 'Arg for MdStep. The title of the step.' ,
59
+ table : {
60
+ type : {
61
+ summary : 'string' ,
62
+ } ,
63
+ } ,
64
+ control : { type : 'string' } ,
65
+ } ,
66
+ MdStep_completedContent : {
67
+ type : { name : 'ReactNode' } ,
68
+ description : 'Arg for MdStep. The content to show when the step is completed. This is optional' ,
69
+ table : {
70
+ type : {
71
+ summary : 'ReactNode' ,
72
+ } ,
73
+ } ,
74
+ control : { type : 'ReactNode' } ,
75
+ } ,
76
+ MdStep_children : {
77
+ type : { name : 'ReactNode' } ,
78
+ description : 'Arg for MdStep. The content of the step.' ,
79
+ table : {
80
+ type : {
81
+ summary : 'ReactNode' ,
82
+ } ,
83
+ } ,
84
+ control : { type : 'ReactNode' } ,
85
+ } ,
56
86
} ,
57
87
} ;
58
88
89
+ export const Stepper : StoryFn < typeof MdStepper > = ( args : Args ) => {
90
+ const [ , updateArgs ] = useArgs ( ) ;
91
+
92
+ const nextStep = ( ) => {
93
+ updateArgs ( { activeStep : args . activeStep + 1 } ) ;
94
+ } ;
95
+
96
+ const prevStep = ( ) => {
97
+ updateArgs ( { activeStep : args . activeStep - 1 } ) ;
98
+ } ;
99
+
100
+ return (
101
+ < >
102
+ < MdStepper activeStep = { args . activeStep } >
103
+ < MdStep
104
+ title = "Step 1"
105
+ completedContent = {
106
+ < >
107
+ This is a completed step, which can be shown differently if the "completedContent" prop is
108
+ provided
109
+ </ >
110
+ }
111
+ >
112
+ < div >
113
+ This is a step
114
+ < MdButton onClick = { nextStep } small >
115
+ Next
116
+ </ MdButton >
117
+ </ div >
118
+ </ MdStep >
119
+ < MdStep
120
+ title = "Step 2"
121
+ completedContent = { < > This is what Step 2 looks like when completed, this is completely customizable!</ > }
122
+ >
123
+ < div >
124
+ This is the content of a MdStep. It can contain anything you want, text or HTML.
125
+ < p > Here is a paragraph!</ p >
126
+ < MdButton onClick = { nextStep } small >
127
+ Next
128
+ </ MdButton >
129
+ < MdButton onClick = { prevStep } theme = "secondary" small >
130
+ Previous
131
+ </ MdButton >
132
+ </ div >
133
+ </ MdStep >
134
+ < MdStep title = "Step 3" >
135
+ < div >
136
+ This is the last step in this example
137
+ < MdButton onClick = { prevStep } theme = "secondary" small >
138
+ Previous
139
+ </ MdButton >
140
+ </ div >
141
+ </ MdStep >
142
+ </ MdStepper >
143
+ </ >
144
+ ) ;
145
+ } ;
146
+ Stepper . args = {
147
+ activeStep : 1 ,
148
+ } ;
149
+
150
+ /*
59
151
const Template: StoryFn<typeof MdStepper> = (args: Args) => {
60
152
const [, updateArgs] = useArgs();
61
153
@@ -117,4 +209,4 @@ const Template: StoryFn<typeof MdStepper> = (args: Args) => {
117
209
export const Stepper = Template.bind({});
118
210
Stepper.args = {
119
211
activeStep: 1,
120
- } ;
212
+ }; */
0 commit comments