2024-06-07 20:17:03 +03:00
|
|
|
import clsx from 'clsx';
|
|
|
|
|
2025-02-20 20:22:05 +03:00
|
|
|
import { type EventMouse, type Styling, type Titled } from '@/components/props';
|
2025-02-20 18:10:34 +03:00
|
|
|
import { globalIDs } from '@/utils/constants';
|
2024-06-07 20:17:03 +03:00
|
|
|
|
2025-02-20 20:22:05 +03:00
|
|
|
interface NavigationButtonProps extends Titled, Styling {
|
2024-06-07 20:17:03 +03:00
|
|
|
text?: string;
|
|
|
|
icon: React.ReactNode;
|
2025-02-20 20:22:05 +03:00
|
|
|
onClick?: (event: EventMouse) => void;
|
2024-06-07 20:17:03 +03:00
|
|
|
}
|
|
|
|
|
2025-02-19 23:29:45 +03:00
|
|
|
export function NavigationButton({
|
2024-12-12 13:17:24 +03:00
|
|
|
icon,
|
|
|
|
title,
|
|
|
|
className,
|
|
|
|
style,
|
|
|
|
titleHtml,
|
|
|
|
hideTitle,
|
|
|
|
onClick,
|
|
|
|
text
|
|
|
|
}: NavigationButtonProps) {
|
2024-06-07 20:17:03 +03:00
|
|
|
return (
|
|
|
|
<button
|
|
|
|
type='button'
|
|
|
|
tabIndex={-1}
|
2025-02-20 18:10:34 +03:00
|
|
|
data-tooltip-id={!!title || !!titleHtml ? globalIDs.tooltip : undefined}
|
2024-06-07 20:17:03 +03:00
|
|
|
data-tooltip-html={titleHtml}
|
|
|
|
data-tooltip-content={title}
|
|
|
|
data-tooltip-hidden={hideTitle}
|
|
|
|
onClick={onClick}
|
|
|
|
className={clsx(
|
2025-01-23 19:41:31 +03:00
|
|
|
'mr-1 h-full', //
|
2024-06-07 20:17:03 +03:00
|
|
|
'flex items-center gap-1',
|
2024-12-20 11:54:10 +03:00
|
|
|
'clr-btn-nav cc-animate-color duration-500',
|
2024-06-07 23:17:49 +03:00
|
|
|
'rounded-xl',
|
2024-06-07 20:17:03 +03:00
|
|
|
'font-controls whitespace-nowrap',
|
|
|
|
{
|
|
|
|
'px-2': text,
|
|
|
|
'px-4': !text
|
2024-12-12 13:17:24 +03:00
|
|
|
},
|
|
|
|
className
|
2024-06-07 20:17:03 +03:00
|
|
|
)}
|
2024-12-12 13:17:24 +03:00
|
|
|
style={style}
|
2024-06-07 20:17:03 +03:00
|
|
|
>
|
|
|
|
{icon ? <span>{icon}</span> : null}
|
|
|
|
{text ? <span className='hidden sm:inline'>{text}</span> : null}
|
|
|
|
</button>
|
|
|
|
);
|
|
|
|
}
|