@@ -5,75 +5,56 @@ import PropTypes from 'prop-types';
55
66export const docsLinks = {
77 mui : 'https://material-ui.com/api/' ,
8- pf4 : 'http ://patternfly-react.surge.sh/patternfly-4 /components/' ,
9- pf3 : 'http ://patternfly-react.surge.sh/patternfly-3/index.html '
8+ pf4 : 'https ://patternfly-react.surge.sh/documentation/react /components/' ,
9+ pf3 : 'https ://patternfly-react-pf3 .surge.sh/?path=/story/* '
1010} ;
1111
12+ const mapper = ( activeMapper , component ) =>
13+ ( {
14+ pf4 : {
15+ 'date-picker' : 'textintput' ,
16+ 'text-field' : 'textinput' ,
17+ 'time-picker' : 'textinput' ,
18+ 'checkbox-multiple' : 'checkbox'
19+ } ,
20+ mui : {
21+ 'date-picker' : 'text-field' ,
22+ 'text-field' : 'text-field' ,
23+ 'time-picker' : 'text-field' ,
24+ 'checkbox-multiple' : 'checkbox' ,
25+ 'text-area' : 'textarea'
26+ }
27+ } [ activeMapper ] [ component ] || component ) ;
28+
1229const GenericMuiComponent = ( { activeMapper, component } ) => {
1330 const originalComponent = component ;
14- if ( activeMapper === 'pf4' ) {
15- switch ( component ) {
16- case 'date-picker' :
17- component = 'textinput' ;
18- break ;
19- case 'select' :
20- component = 'select' ;
21- break ;
22- case 'switch' :
23- component = 'switch' ;
24- break ;
25- case 'textarea' :
26- component = 'textarea' ;
27- break ;
28- case 'text-field' :
29- component = 'textinput' ;
30- break ;
31- case 'time-picker' :
32- component = 'textinput' ;
33- break ;
34- case 'checkbox-multiple' :
35- component = 'checkbox' ;
36- break ;
37- default :
38- break ;
39- }
40- } else if ( activeMapper === 'mui' ) {
41- switch ( component ) {
42- case 'date-picker' :
43- component = 'text-field' ;
44- break ;
45- case 'select' :
46- component = 'select' ;
47- break ;
48- case 'switch' :
49- component = 'switch' ;
50- break ;
51- case 'textarea' :
52- component = 'text-field' ;
53- break ;
54- case 'time-picker' :
55- component = 'text-field' ;
56- break ;
57- case 'checkbox-multiple' :
58- component = 'checkbox' ;
59- break ;
60- default :
61- break ;
62- }
63- }
6431
6532 return (
6633 < React . Fragment >
6734 < Typography variant = "body1" gutterBottom >
6835 This component also accepts all other original props, please see{ ' ' }
69- < a href = { `${ docsLinks [ activeMapper ] } ${ activeMapper === 'pf4' || activeMapper === 'mui' ? component : '' } ` } > here</ a > !
36+ < a
37+ target = "__blank"
38+ rel = "noreferrer noopener"
39+ href = { `${ docsLinks [ activeMapper ] } ${ activeMapper === 'pf4' || activeMapper === 'mui' ? mapper ( activeMapper , component ) : '' } ` }
40+ >
41+ here
42+ </ a >
43+ !
7044 </ Typography >
7145
7246 { activeMapper === 'mui'
7347 ? ( originalComponent === 'date-picker' || originalComponent === 'time-picker' ) && (
7448 < Typography variant = "body1" >
7549 This component also use API from material-ui-pickers, please see{ ' ' }
76- < a href = { `https://material-ui-pickers.firebaseapp.com/api/${ originalComponent . replace ( '-' , '' ) } ` } > here</ a > !
50+ < a
51+ target = "__blank"
52+ rel = "noreferrer noopener"
53+ href = { `https://material-ui-pickers.firebaseapp.com/api/${ originalComponent . replace ( '-' , '' ) } ` }
54+ >
55+ here
56+ </ a >
57+ !
7758 </ Typography >
7859 )
7960 : '' }
0 commit comments