ConceptPortal-public/rsconcept/frontend/src/components/Common/SelectorButton.tsx

46 lines
1.0 KiB
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-10-06 14:39:32 +03:00
interface SelectorButtonProps
extends CProps.Button {
2023-10-06 14:39:32 +03:00
text?: string
icon?: React.ReactNode
2023-11-05 16:31:49 +03:00
colors?: string
2023-10-06 14:39:32 +03:00
transparent?: boolean
}
function SelectorButton({
2023-12-21 00:12:24 +03:00
text, icon, title,
2023-11-05 16:31:49 +03:00
colors = 'clr-btn-default',
className,
2023-10-06 14:39:32 +03:00
transparent,
...restProps
2023-10-06 14:39:32 +03:00
}: SelectorButtonProps) {
return (
<button type='button'
2023-12-21 00:12:24 +03:00
data-tooltip-id={title ? (globalIDs.tooltip) : undefined}
data-tooltip-content={title}
className={clsx(
'px-1 flex flex-start items-center gap-1',
'text-sm small-caps select-none',
'text-btn clr-text-controls',
'disabled:cursor-not-allowed cursor-pointer',
{
'clr-hover': transparent,
'border': !transparent,
},
className,
!transparent && colors
)}
{...restProps}
>
{icon ? icon : null}
{text ? <div className={'font-semibold whitespace-nowrap pb-1'}>{text}</div> : null}
</button>);
2023-10-06 14:39:32 +03:00
}
export default SelectorButton;