import React from 'react' ; import { Router } from 'react-router' ; import { createMemoryHistory } from 'history' ; import Clusters from './Clusters' ; import * as fixtures from './fixtures' ; import * as teleport from 'teleport' ; export default { title : 'Teleport/Clusters' , excludeStories : [ 'createContext' ] , } ; export function Story ( { value } ) { const ctx = value || createContext ( ) ; return ( < teleport . ContextProvider ctx = { ctx } > < Router history = { createMemoryHistory ( ) } > < Clusters /> < /Router> < /teleport.ContextProvider>); } Story . storyName = 'Clusters' ; export function createContext ( ) { const ctx = new teleport . Context ( ) ; ctx . clusterService . fetchClusters = ( ) => Promise . resolve ( fixtures . clusters ) ; return ctx ; }