2023-12-15 17:34:50 +03:00
|
|
|
import clsx from 'clsx';
|
|
|
|
|
2024-03-09 16:40:10 +03:00
|
|
|
import { CProps } from '@/components/props';
|
2025-02-20 18:10:53 +03:00
|
|
|
import { globalIDs } from '@/utils/constants';
|
2023-12-21 00:12:24 +03:00
|
|
|
|
2024-12-12 13:19:12 +03:00
|
|
|
interface NavigationButtonProps extends CProps.Titled, CProps.Styling {
|
2023-12-28 14:04:44 +03:00
|
|
|
text?: string;
|
|
|
|
icon: React.ReactNode;
|
2024-04-07 19:45:07 +03:00
|
|
|
onClick?: (event: CProps.EventMouse) => void;
|
2023-07-15 17:46:19 +03:00
|
|
|
}
|
|
|
|
|
2025-02-19 23:30:35 +03:00
|
|
|
export function NavigationButton({
|
2024-12-12 13:19:12 +03:00
|
|
|
icon,
|
|
|
|
title,
|
|
|
|
className,
|
|
|
|
style,
|
|
|
|
titleHtml,
|
|
|
|
hideTitle,
|
|
|
|
onClick,
|
|
|
|
text
|
|
|
|
}: NavigationButtonProps) {
|
2023-07-15 17:46:19 +03:00
|
|
|
return (
|
2023-12-28 14:04:44 +03:00
|
|
|
<button
|
|
|
|
type='button'
|
|
|
|
tabIndex={-1}
|
2025-02-20 18:10:53 +03:00
|
|
|
data-tooltip-id={!!title || !!titleHtml ? globalIDs.tooltip : undefined}
|
2024-03-08 18:39:08 +03:00
|
|
|
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
|
|
|
onClick={onClick}
|
|
|
|
className={clsx(
|
2025-01-27 15:03:48 +03:00
|
|
|
'mr-1 h-full', //
|
2023-12-28 14:04:44 +03:00
|
|
|
'flex items-center gap-1',
|
2024-12-20 11:54:38 +03:00
|
|
|
'clr-btn-nav cc-animate-color duration-500',
|
2024-06-07 23:18:05 +03:00
|
|
|
'rounded-xl',
|
2023-12-30 19:43:24 +03:00
|
|
|
'font-controls whitespace-nowrap',
|
2023-12-28 14:04:44 +03:00
|
|
|
{
|
|
|
|
'px-2': text,
|
|
|
|
'px-4': !text
|
2024-12-12 13:19:12 +03:00
|
|
|
},
|
|
|
|
className
|
2023-12-28 14:04:44 +03:00
|
|
|
)}
|
2024-12-12 13:19:12 +03:00
|
|
|
style={style}
|
2023-12-28 14:04:44 +03:00
|
|
|
>
|
|
|
|
{icon ? <span>{icon}</span> : null}
|
2024-01-16 13:47:29 +03:00
|
|
|
{text ? <span className='hidden sm:inline'>{text}</span> : null}
|
2023-12-28 14:04:44 +03:00
|
|
|
</button>
|
|
|
|
);
|
2023-07-15 17:46:19 +03:00
|
|
|
}
|