2022-04-24 15:01:57 -07:00
|
|
|
import classNames from 'classnames';
|
2022-01-10 14:17:52 -08:00
|
|
|
import React from 'react';
|
2020-03-27 13:59:38 -07:00
|
|
|
|
2022-04-24 15:01:57 -07:00
|
|
|
interface IBadge {
|
2022-05-24 08:16:07 -07:00
|
|
|
title: React.ReactNode,
|
2022-04-24 15:27:08 -07:00
|
|
|
slug: 'patron' | 'donor' | 'admin' | 'moderator' | 'bot' | 'opaque',
|
2022-04-24 15:01:57 -07:00
|
|
|
}
|
2020-03-27 13:59:38 -07:00
|
|
|
|
2022-04-24 15:01:57 -07:00
|
|
|
/** Badge to display on a user's profile. */
|
|
|
|
const Badge: React.FC<IBadge> = ({ title, slug }) => (
|
|
|
|
<span
|
|
|
|
data-testid='badge'
|
2022-08-08 13:30:36 -07:00
|
|
|
className={classNames('inline-flex items-center px-2 py-0.5 rounded text-xs font-medium', {
|
|
|
|
'bg-fuchsia-700 text-white': slug === 'patron',
|
|
|
|
'bg-yellow-500 text-white': slug === 'donor',
|
|
|
|
'bg-black text-white': slug === 'admin',
|
|
|
|
'bg-cyan-600 text-white': slug === 'moderator',
|
2022-07-22 10:30:16 -07:00
|
|
|
'bg-gray-100 dark:bg-gray-800 text-gray-900 dark:text-gray-100': slug === 'bot',
|
2022-04-24 15:01:57 -07:00
|
|
|
'bg-white bg-opacity-75 text-gray-900': slug === 'opaque',
|
|
|
|
})}
|
|
|
|
>
|
|
|
|
{title}
|
|
|
|
</span>
|
|
|
|
);
|
2020-04-14 14:37:17 -07:00
|
|
|
|
2020-03-27 13:59:38 -07:00
|
|
|
export default Badge;
|