@@ -24,6 +24,7 @@ import { pf4Code, pf4WizardCode, pf4Html, pf4Dependencies } from '../stackblitz-
2424import { pf3Code , pf3WizardCode , pf3Html , pf3Dependencies } from '../stackblitz-templates/pf3-templates' ;
2525import { blueprintCode , blueprintWizardCode , blueprintHtml , blueprintDependencies } from '../stackblitz-templates/blueprint-templates' ;
2626import { suirCode , suirWizardCode , suirHtml , suirDependencies } from '../stackblitz-templates/suir-template' ;
27+ import avalableMappers from '../helpers/available-mappers' ;
2728
2829const project = {
2930 settings : {
@@ -146,15 +147,7 @@ const mapperTab = {
146147 suir : 4
147148} ;
148149
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 } ) => {
158151 const activeTab = mapperTab [ activeMapper ] ;
159152 const { pathname, push } = useRouter ( ) ;
160153 const classes = useStyles ( ) ;
@@ -167,15 +160,15 @@ const ComponentExample = ({ baseStructure, activeMapper, component }) => {
167160 files : {
168161 ...blitzFiles [ activeMapper ] ,
169162 ...( 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 ) } ;`
171164 }
172165 } ,
173166 { height : '100%' , hideNavigation : true , forceEmbedLayout : true , openFile : 'schema.js' }
174167 ) ;
175- } , [ activeMapper , baseStructure . value ] ) ;
168+ } , [ activeMapper , schema ] ) ;
176169
177170 const renderMapperTabs = ( ) =>
178- tabs . map ( ( { title, mapper } , index ) => (
171+ avalableMappers . map ( ( { title, mapper } , index ) => (
179172 < Tab
180173 key = { mapper }
181174 value = { index }
@@ -205,7 +198,7 @@ const ComponentExample = ({ baseStructure, activeMapper, component }) => {
205198 </ TableRow >
206199 </ TableHead >
207200 < TableBody >
208- { baseStructure . variants . map ( ( { name, type, required } ) => (
201+ { variants . map ( ( { name, type, required } ) => (
209202 < TableRow key = { name } >
210203 < TableCell > { name } </ TableCell >
211204 < TableCell > { `${ type } ` } </ TableCell >
@@ -255,10 +248,14 @@ const ComponentExample = ({ baseStructure, activeMapper, component }) => {
255248ComponentExample . propTypes = {
256249 component : PropTypes . string . isRequired ,
257250 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
262259} ;
263260
264261export default ComponentExample ;
0 commit comments