@@ -5,7 +5,7 @@ import SwipeableViews from 'react-swipeable-views'
5
5
6
6
import { setActiveItinerary , setActiveLeg , setActiveStep } from '../../actions/narrative'
7
7
import Icon from './icon'
8
- import NarrativeItinerary from './narrative -itinerary'
8
+ import DefaultItinerary from './default/default -itinerary'
9
9
import Loading from './loading'
10
10
import { getActiveSearch } from '../../util/state'
11
11
@@ -16,12 +16,17 @@ class ItineraryCarousel extends Component {
16
16
pending : PropTypes . bool ,
17
17
activeItinerary : PropTypes . number ,
18
18
hideHeader : PropTypes . bool ,
19
+ itineraryClass : PropTypes . func ,
19
20
onExpand : PropTypes . func ,
20
21
setActiveItinerary : PropTypes . func ,
21
22
setActiveLeg : PropTypes . func ,
22
23
setActiveStep : PropTypes . func
23
24
}
24
25
26
+ static defaultProps = {
27
+ itineraryClass : DefaultItinerary
28
+ }
29
+
25
30
_onItineraryClick = ( ) => {
26
31
const expanded = ! this . state . expanded
27
32
this . setState ( { expanded} )
@@ -43,7 +48,7 @@ class ItineraryCarousel extends Component {
43
48
}
44
49
45
50
render ( ) {
46
- const { activeItinerary, itineraries, hideHeader, pending } = this . props
51
+ const { activeItinerary, itineraries, itineraryClass , hideHeader, pending } = this . props
47
52
if ( pending ) return < Loading />
48
53
if ( ! itineraries ) return null
49
54
@@ -75,16 +80,14 @@ class ItineraryCarousel extends Component {
75
80
onChangeIndex = { this . _onSwipe }
76
81
>
77
82
{ itineraries . map ( ( itinerary , index ) => {
78
- return (
79
- < NarrativeItinerary
80
- itinerary = { itinerary }
81
- index = { index }
82
- key = { index }
83
- expanded = { this . state . expanded }
84
- onClick = { this . _onItineraryClick }
85
- { ...this . props }
86
- />
87
- )
83
+ return React . createElement ( itineraryClass , {
84
+ itinerary,
85
+ index,
86
+ key : index ,
87
+ expanded : this . state . expanded ,
88
+ onClick : this . _onItineraryClick ,
89
+ ...this . props
90
+ } )
88
91
} ) }
89
92
</ SwipeableViews >
90
93
</ div >
0 commit comments