import React from 'react' ; import { ITimelineConfig , ITrackEventConfig , TimelineEvent , TimelineTrackSpecification , } from './types' ; import _ from 'lodash' ; export const configureTracks = function ( tracks , timelineConfig , parentConf ? ) { tracks . forEach ( track => { const conf = timelineConfig . trackEventRenderers ? timelineConfig . trackEventRenderers . find ( conf => conf . trackTypeMatch . test ( track . type ) ) : undefined ; track . timelineConfig = timelineConfig ; if ( conf ) { track . trackConf = conf ; conf . configureTrack ( track ) ; } else if ( parentConf ) { track . trackConf = parentConf ; } if ( track . tracks && track . tracks . length ) { configureTracks ( track . tracks , timelineConfig , conf || parentConf ) ; } } ) ; } ;