// @flow import * as React from 'react'; import compose from 'recompose/compose'; import { connect } from 'react-redux'; import type { Dispatch } from 'redux'; import { Span, ProBadge, BlockedBadge, PendingBadge, TeamBadge } from './style'; import { withCurrentUser } from 'src/components/withCurrentUser'; import Tooltip from 'src/components/tooltip'; type Props = { type: string, label?: string, onClick?: Function, tipText: string, currentUser: ?Object, dispatch: Dispatch, }; class Badge extends React.Component { render() { const { type, label, ...rest } = this.props; switch (type) { case 'beta-supporter': return ( {label || 'Supporter'} ); case 'blocked': return ( {label || type} ); case 'pending': return ( {label || type} ); case 'moderator': case 'admin': return ( Team ); default: return ( {label || type} ); } } } export default compose( withCurrentUser, connect() )(Badge);