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

40 lines
1.0 KiB
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
import { globals } from '@/utils/constants';
2023-12-21 00:12:24 +03:00
2024-03-09 16:40:10 +03:00
import { CProps } from '../props';
interface TabLabelProps extends Omit<TabPropsImpl, 'children'>, CProps.Titled {
2023-12-28 14:04:44 +03:00
label?: string;
2023-08-27 15:39:49 +03:00
}
2024-03-09 16:40:10 +03:00
function TabLabel({ label, title, titleHtml, hideTitle, className, ...otherProps }: TabLabelProps) {
2023-07-15 17:46:19 +03:00
return (
<TabImpl
2023-12-28 14:04:44 +03:00
className={clsx(
'min-w-[5.5rem] 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',
2024-05-12 13:58:28 +03:00
'outline-none',
2023-12-28 14:04:44 +03:00
className
)}
2024-05-12 13:58:28 +03:00
tabIndex='-1'
data-tooltip-id={!!title || !!titleHtml ? globals.tooltip : undefined}
data-tooltip-html={titleHtml}
2023-12-28 14:04:44 +03:00
data-tooltip-content={title}
2024-03-09 16:40:10 +03:00
data-tooltip-hidden={hideTitle}
2023-12-28 14:04:44 +03:00
{...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;