bigbuffet-rw/packages/pl-fe/src/components/icon-with-counter.tsx
marcin mikołajczak 966b04fdf0 Call it pl-fe internally
Signed-off-by: marcin mikołajczak <git@mkljczk.pl>
2024-08-28 13:41:08 +02:00

25 lines
640 B
TypeScript

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