import React from 'react' import { NumericFormat } from 'react-number-format' import { largeNumConversion } from '../../services/HelperServiceTyped' import { cn } from '../../services/cn' export const pillColorList = [ 'red', 'blue', 'green', 'purple', 'medium-purple', 'dark-purple', ] as const export type PillColorList = (typeof pillColorList)[number] export type PillProps = { /** Available colors for the Pill */ color: PillColorList /** The number to display inside the Pill */ number: number /** Loading state for the Pill */ loading?: boolean /** Optional prop to add a test id to the Pill for QA testing */ qaTestId?: string } const pillColorVariants = { red: 'bg-dark-red text-white', blue: 'bg-dark-blue text-white', green: 'bg-medium-green text-dark-purple', purple: 'bg-purple text-white', 'medium-purple': 'bg-medium-purple text-dark-purple', 'dark-purple': 'bg-dark-purple text-white', } as const const Pill = ({ color, number, loading, qaTestId = 'pill', }: PillProps): React.JSX.Element => { const formattedNumber = largeNumConversion(number).val return (
{!loading ? ( ) : ( // Using this instead of `Mdash` because our `Mdash` component does not support the colors that `Pill` needs. )}
) } export default Pill