Skip to content

Instantly share code, notes, and snippets.

@jsmanifest
Created July 3, 2019 16:06
Show Gist options
  • Save jsmanifest/fa656fc47e18c9c2d3c55a3bec2af62c to your computer and use it in GitHub Desktop.
Save jsmanifest/fa656fc47e18c9c2d3c55a3bec2af62c to your computer and use it in GitHub Desktop.
const TotalVideoCount = ({ classes, total, fetching, fetchError }) => {
if (fetching) return <LoadingSpinner />
const hasResults = !!total
const noResults = fetched && !total
const errorOccurred = !!fetchError
return (
<Typography
variant="h3"
className={classes.root}
error={!!fetched && !!fetchError}
primary={hasResults}
soft={noResults || errorOccurred}
center
>
{noResults && 'No Results'}
{hasResults && `$${formatTotal(total)}`}
{errorOccurred && 'An error occurred.'}
</Typography>
)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment