Portal/rsconcept/frontend/src/components/ui/IconValue.tsx

48 lines
1.1 KiB
TypeScript
Raw Normal View History

2024-08-21 21:36:02 +03:00
import clsx from 'clsx';
2024-08-22 22:41:29 +03:00
import { globals } from '@/utils/constants';
2024-08-21 21:36:02 +03:00
import { CProps } from '../props';
import MiniButton from './MiniButton';
interface IconValueProps extends CProps.Styling, CProps.Titled {
id?: string;
icon: React.ReactNode;
value: string | number;
onClick?: (event: CProps.EventMouse) => void;
dense?: boolean;
disabled?: boolean;
}
function IconValue({
id,
dense,
value,
icon,
disabled = true,
title,
titleHtml,
hideTitle,
className,
onClick,
...restProps
}: IconValueProps) {
return (
<div
2024-08-22 21:38:59 +03:00
className={clsx('flex items-center text-right', { 'justify-between gap-6': !dense, 'gap-1': dense }, className)}
2024-08-21 21:36:02 +03:00
{...restProps}
2024-08-22 22:41:29 +03:00
data-tooltip-id={!!title || !!titleHtml ? globals.tooltip : undefined}
data-tooltip-html={titleHtml}
data-tooltip-content={title}
data-tooltip-hidden={hideTitle}
2024-08-21 21:36:02 +03:00
>
2024-08-22 22:41:29 +03:00
<MiniButton noHover noPadding icon={icon} disabled={disabled} onClick={onClick} />
2024-08-22 21:38:59 +03:00
<span id={id} className='min-w-[1.2rem]'>
{value}
</span>
2024-08-21 21:36:02 +03:00
</div>
);
}
export default IconValue;