bigbuffet-rw/app/soapbox/components/ui/counter/counter.tsx

22 lines
626 B
TypeScript
Raw Normal View History

2022-04-28 14:29:15 -07:00
import React from 'react';
import { shortNumberFormat } from 'soapbox/utils/numbers';
interface ICounter {
/** Number this counter should display. */
2022-04-28 14:29:15 -07:00
count: number,
2022-11-03 09:13:45 -07:00
/** Optional max number (ie: N+) */
countMax?: number
2022-04-28 14:29:15 -07:00
}
/** A simple counter for notifications, etc. */
2022-11-03 09:13:45 -07:00
const Counter: React.FC<ICounter> = ({ count, countMax }) => {
2022-04-28 14:29:15 -07:00
return (
<span className='h-5 min-w-[20px] max-w-[26px] flex items-center justify-center bg-secondary-500 text-xs font-medium text-white rounded-full ring-2 ring-white dark:ring-gray-800'>
2022-11-03 09:13:45 -07:00
{shortNumberFormat(count, countMax)}
2022-04-28 14:29:15 -07:00
</span>
);
};
export default Counter;