ConceptPortal-public/rsconcept/frontend/src/components/View/Indicator.tsx
Ivan 74186b268b
Some checks are pending
Frontend CI / build (22.x) (push) Waiting to run
npm update + fix name collision
2025-02-20 18:10:53 +03:00

38 lines
922 B
TypeScript

import clsx from 'clsx';
import { CProps } from '@/components/props';
import { globalIDs } from '@/utils/constants';
interface IndicatorProps extends CProps.Titled, CProps.Styling {
/** Icon to display. */
icon: React.ReactNode;
/** Indicates whether the indicator should have no padding. */
noPadding?: boolean;
}
/**
* Displays a status `icon` with a tooltip.
*/
export function Indicator({ icon, title, titleHtml, hideTitle, noPadding, className, ...restProps }: IndicatorProps) {
return (
<div
className={clsx(
'clr-text-controls',
'outline-none',
{
'px-1 py-1': !noPadding
},
className
)}
data-tooltip-id={!!title || !!titleHtml ? globalIDs.tooltip : undefined}
data-tooltip-html={titleHtml}
data-tooltip-content={title}
data-tooltip-hidden={hideTitle}
{...restProps}
>
{icon}
</div>
);
}