mirror of
https://github.com/IRBorisov/ConceptPortal.git
synced 2025-06-26 13:00:39 +03:00
42 lines
1.1 KiB
TypeScript
42 lines
1.1 KiB
TypeScript
import clsx from 'clsx';
|
|
|
|
import { CProps } from '@/components/props';
|
|
import { globals } from '@/utils/constants';
|
|
|
|
interface NavigationButtonProps extends CProps.Titled {
|
|
text?: string;
|
|
icon: React.ReactNode;
|
|
onClick?: (event: CProps.EventMouse) => void;
|
|
}
|
|
|
|
function NavigationButton({ icon, title, titleHtml, hideTitle, onClick, text }: NavigationButtonProps) {
|
|
return (
|
|
<button
|
|
type='button'
|
|
tabIndex={-1}
|
|
data-tooltip-id={!!title || !!titleHtml ? globals.tooltip : undefined}
|
|
data-tooltip-html={titleHtml}
|
|
data-tooltip-content={title}
|
|
data-tooltip-hidden={hideTitle}
|
|
onClick={onClick}
|
|
className={clsx(
|
|
'mr-1 h-full', // prettier: split lines
|
|
'flex items-center gap-1',
|
|
'clr-btn-nav',
|
|
'rounded-xl',
|
|
'transition duration-500',
|
|
'font-controls whitespace-nowrap',
|
|
{
|
|
'px-2': text,
|
|
'px-4': !text
|
|
}
|
|
)}
|
|
>
|
|
{icon ? <span>{icon}</span> : null}
|
|
{text ? <span className='hidden sm:inline'>{text}</span> : null}
|
|
</button>
|
|
);
|
|
}
|
|
|
|
export default NavigationButton;
|