@@ -24,6 +24,7 @@ import { pf4Code, pf4WizardCode, pf4Html, pf4Dependencies } from '../stackblitz-
24
24
import { pf3Code , pf3WizardCode , pf3Html , pf3Dependencies } from '../stackblitz-templates/pf3-templates' ;
25
25
import { blueprintCode , blueprintWizardCode , blueprintHtml , blueprintDependencies } from '../stackblitz-templates/blueprint-templates' ;
26
26
import { suirCode , suirWizardCode , suirHtml , suirDependencies } from '../stackblitz-templates/suir-template' ;
27
+ import avalableMappers from '../helpers/available-mappers' ;
27
28
28
29
const project = {
29
30
settings : {
@@ -146,15 +147,7 @@ const mapperTab = {
146
147
suir : 4
147
148
} ;
148
149
149
- const tabs = [
150
- { title : 'MUI' , mapper : 'mui' } ,
151
- { title : 'PF4' , mapper : 'pf4' } ,
152
- { title : 'PF3' , mapper : 'pf3' } ,
153
- { title : 'BJS' , mapper : 'blueprint' } ,
154
- { title : 'SUIR' , mapper : 'suir' }
155
- ] ;
156
-
157
- const ComponentExample = ( { baseStructure, activeMapper, component } ) => {
150
+ const ComponentExample = ( { variants, schema, activeMapper, component } ) => {
158
151
const activeTab = mapperTab [ activeMapper ] ;
159
152
const { pathname, push } = useRouter ( ) ;
160
153
const classes = useStyles ( ) ;
@@ -167,15 +160,15 @@ const ComponentExample = ({ baseStructure, activeMapper, component }) => {
167
160
files : {
168
161
...blitzFiles [ activeMapper ] ,
169
162
...( component === 'wizard' && { 'index.js' : blitzWizards [ activeMapper ] } ) ,
170
- 'schema.js' : `export default ${ JSON . stringify ( baseStructure . value , null , 2 ) } ;`
163
+ 'schema.js' : `export default ${ JSON . stringify ( schema , null , 2 ) } ;`
171
164
}
172
165
} ,
173
166
{ height : '100%' , hideNavigation : true , forceEmbedLayout : true , openFile : 'schema.js' }
174
167
) ;
175
- } , [ activeMapper , baseStructure . value ] ) ;
168
+ } , [ activeMapper , schema ] ) ;
176
169
177
170
const renderMapperTabs = ( ) =>
178
- tabs . map ( ( { title, mapper } , index ) => (
171
+ avalableMappers . map ( ( { title, mapper } , index ) => (
179
172
< Tab
180
173
key = { mapper }
181
174
value = { index }
@@ -205,7 +198,7 @@ const ComponentExample = ({ baseStructure, activeMapper, component }) => {
205
198
</ TableRow >
206
199
</ TableHead >
207
200
< TableBody >
208
- { baseStructure . variants . map ( ( { name, type, required } ) => (
201
+ { variants . map ( ( { name, type, required } ) => (
209
202
< TableRow key = { name } >
210
203
< TableCell > { name } </ TableCell >
211
204
< TableCell > { `${ type } ` } </ TableCell >
@@ -255,10 +248,14 @@ const ComponentExample = ({ baseStructure, activeMapper, component }) => {
255
248
ComponentExample . propTypes = {
256
249
component : PropTypes . string . isRequired ,
257
250
activeMapper : PropTypes . string . isRequired ,
258
- baseStructure : PropTypes . shape ( {
259
- variants : PropTypes . array . isRequired ,
260
- value : PropTypes . object . isRequired
261
- } ) . isRequired
251
+ schema : PropTypes . object . isRequired ,
252
+ variants : PropTypes . arrayOf (
253
+ PropTypes . shape ( {
254
+ name : PropTypes . string . isRequired ,
255
+ type : PropTypes . string . isRequired ,
256
+ required : PropTypes . bool
257
+ } )
258
+ ) . isRequired
262
259
} ;
263
260
264
261
export default ComponentExample ;
0 commit comments