bigbuffet-rw/app/soapbox/components/icon-with-counter.tsx
marcin mikołajczak d351ffab18 Fix 'Icon counter is italicized'
Signed-off-by: marcin mikołajczak <git@mkljczk.pl>
2022-11-17 10:52:56 +01:00

26 lines
618 B
TypeScript

import React from 'react';
import Icon, { IIcon } from 'soapbox/components/icon';
import { Counter } from 'soapbox/components/ui';
interface IIconWithCounter extends React.HTMLAttributes<HTMLDivElement> {
count: number,
icon?: string;
src?: string;
}
const IconWithCounter: React.FC<IIconWithCounter> = ({ icon, count, ...rest }) => {
return (
<div className='relative'>
<Icon id={icon} {...rest as IIcon} />
{count > 0 && (
<span className='absolute -top-2 -right-2'>
<Counter count={count} />
</span>
)}
</div>
);
};
export default IconWithCounter;