ConceptPortal-public/rsconcept/frontend/src/components/ui/MiniButton.tsx

49 lines
961 B
TypeScript
Raw Normal View History

import clsx from 'clsx';
2023-12-21 00:12:24 +03:00
import { globalIDs } from '@/utils/constants';
import { CProps } from '../props';
2023-12-28 14:04:44 +03:00
interface MiniButtonProps extends CProps.Button {
icon: React.ReactNode;
noHover?: boolean;
2023-07-27 22:04:25 +03:00
}
function MiniButton({
icon,
noHover,
tabIndex,
title,
titleHtml,
2024-03-09 16:40:10 +03:00
hideTitle,
className,
...restProps
}: MiniButtonProps) {
2023-07-27 22:04:25 +03:00
return (
2023-12-28 14:04:44 +03:00
<button
type='button'
tabIndex={tabIndex ?? -1}
className={clsx(
'px-1 py-1',
'rounded-full',
'clr-btn-clear',
'cursor-pointer disabled:cursor-not-allowed',
{
'outline-none': noHover,
'clr-hover': !noHover
},
className
)}
data-tooltip-id={!!title || !!titleHtml ? globalIDs.tooltip : undefined}
data-tooltip-html={titleHtml}
2023-12-28 14:04:44 +03:00
data-tooltip-content={title}
data-tooltip-hidden={hideTitle}
2023-12-28 14:04:44 +03:00
{...restProps}
>
{icon}
</button>
);
2023-07-27 22:04:25 +03:00
}
2023-12-28 14:04:44 +03:00
export default MiniButton;