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

36 lines
905 B
TypeScript
Raw Normal View History

import clsx from 'clsx';
import type { TabProps as TabPropsImpl } from 'react-tabs';
import { Tab as TabImpl } from 'react-tabs';
2023-07-15 17:46:19 +03:00
2023-12-21 00:12:24 +03:00
import { globalIDs } from '@/utils/constants';
interface TabLabelProps extends Omit<TabPropsImpl, 'children'> {
2023-12-28 14:04:44 +03:00
label?: string;
titleHtml?: string;
2023-08-27 15:39:49 +03:00
}
function TabLabel({ label, title, titleHtml, className, ...otherProps }: TabLabelProps) {
2023-07-15 17:46:19 +03:00
return (
<TabImpl
2023-12-28 14:04:44 +03:00
className={clsx(
2024-02-22 16:25:11 +03:00
'min-w-[6rem] h-full',
2023-12-28 14:04:44 +03:00
'px-2 py-1 flex justify-center',
'clr-tab',
2023-12-30 19:43:24 +03:00
'text-sm whitespace-nowrap font-controls',
2023-12-28 14:04:44 +03:00
'select-none hover:cursor-pointer',
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}
{...otherProps}
>
{label}
</TabImpl>
2023-12-28 14:04:44 +03:00
);
2023-07-15 17:46:19 +03:00
}
TabLabel.tabsRole = 'Tab';
2023-07-15 17:46:19 +03:00
export default TabLabel;