Created
June 2, 2017 17:02
-
-
Save peggyrayzis/bcb69c07a0da23c4350dee6d7bc9fb90 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import React, { Component } from 'react'; | |
import { compose, graphql } from 'react-apollo'; | |
import { NoDataExtension } from '@mls-digital/react-components'; | |
import PostGameExtension from './post-game'; | |
import PreGameExtension from './pre-game'; | |
import PostGameQuery from './post-game.graphql'; | |
import PreGameQuery from './pre-game.graphql'; | |
@compose( | |
graphql(PreGameQuery, { | |
skip: ({ gameStatus }) => gameStatus !== 'pre', | |
props: ({ data }) => ({ | |
preGameLoading: data.loading, | |
preGameProps: data.match, | |
}), | |
}), | |
graphql(PostGameQuery, { | |
skip: ({ gameStatus }) => gameStatus !== 'post', | |
props: ({ data }) => ({ | |
postGameLoading: data.loading, | |
postGameProps: data.match, | |
}), | |
}), | |
) | |
export default class MatchExtensionContainer extends Component { | |
render() { | |
const { | |
preGameLoading, | |
postGameLoading, | |
gameStatus, | |
preGameProps, | |
postGameProps, | |
...rest | |
} = this.props; | |
if (preGameLoading || postGameLoading) | |
return <NoDataExtension gameStatus={gameStatus} />; | |
return gameStatus === 'post' | |
? <PostGameExtension {...postGameProps} {...rest} />; | |
: <PreGameExtension {...preGameProps} {...rest} />; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
hi, Im getting a SyntaxError when I try to pass this file thru a linter called
prettier