pleroma/app/soapbox/components/ui/icon/icon.tsx

26 lines
599 B
TypeScript
Raw Normal View History

2022-03-21 11:09:01 -07:00
import React from 'react';
import SvgIcon from './svg-icon';
2022-03-21 11:09:01 -07:00
interface IIcon {
className?: string,
count?: number,
alt?: string,
src: string,
size?: number,
2022-03-21 11:09:01 -07:00
}
const Icon = ({ src, alt, count, size, ...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
<SvgIcon src={src} size={size} alt={alt} {...filteredProps} />
2022-04-04 12:05:15 -07:00
</div>
);
2022-03-21 11:09:01 -07:00
export default Icon;