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

24 lines
574 B
TypeScript
Raw Normal View History

2022-03-21 11:09:01 -07:00
import React from 'react';
import InlineSVG from 'react-inlinesvg';
interface IIcon {
className?: string,
count?: number,
alt?: string,
src: string,
}
2022-04-04 12:05:15 -07:00
const Icon = ({ src, alt, count, ...filteredProps }: IIcon): JSX.Element => (
2022-04-05 07:42:19 -07:00
<div className='relative' data-testid='icon'>
2022-04-04 12:05:15 -07:00
{count ? (
<span className='absolute -top-2 -right-3 block px-1.5 py-0.5 bg-accent-500 text-xs text-white rounded-full ring-2 ring-white'>
{count}
</span>
) : null}
2022-03-21 11:09:01 -07:00
2022-04-04 12:05:15 -07:00
<InlineSVG src={src} title={alt} {...filteredProps} />
</div>
);
2022-03-21 11:09:01 -07:00
export default Icon;