2024-06-07 20:17:03 +03:00
|
|
|
import clsx from 'clsx';
|
|
|
|
|
2025-03-06 22:26:08 +03:00
|
|
|
import { type Styling } 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-03-06 22:26:08 +03:00
|
|
|
interface NavigationButtonProps extends Styling {
|
2024-06-07 20:17:03 +03:00
|
|
|
text?: string;
|
2025-03-06 22:26:08 +03:00
|
|
|
title?: string;
|
2025-03-07 02:45:37 +03:00
|
|
|
hideTitle?: boolean;
|
2024-06-07 20:17:03 +03:00
|
|
|
icon: React.ReactNode;
|
2025-02-22 14:03:13 +03:00
|
|
|
onClick?: (event: React.MouseEvent<Element>) => void;
|
2024-06-07 20:17:03 +03:00
|
|
|
}
|
|
|
|
|
2025-03-07 02:45:37 +03:00
|
|
|
export function NavigationButton({ icon, title, hideTitle, className, style, onClick, text }: NavigationButtonProps) {
|
2024-06-07 20:17:03 +03:00
|
|
|
return (
|
|
|
|
<button
|
|
|
|
type='button'
|
2025-03-20 14:55:43 +03:00
|
|
|
tabIndex={0}
|
2025-03-06 22:26:08 +03:00
|
|
|
aria-label={title}
|
|
|
|
data-tooltip-id={!!title ? globalIDs.tooltip : undefined}
|
2025-03-07 02:45:37 +03:00
|
|
|
data-tooltip-hidden={hideTitle}
|
2024-06-07 20:17:03 +03:00
|
|
|
data-tooltip-content={title}
|
|
|
|
onClick={onClick}
|
2025-03-19 23:28:32 +03:00
|
|
|
className={clsx('p-2 flex items-center gap-1', 'cc-btn-nav', 'font-controls clr-outline', className)}
|
2024-12-12 13:17:24 +03:00
|
|
|
style={style}
|
2024-06-07 20:17:03 +03:00
|
|
|
>
|
2025-03-09 21:57:21 +03:00
|
|
|
{icon ? icon : null}
|
2024-06-07 20:17:03 +03:00
|
|
|
{text ? <span className='hidden sm:inline'>{text}</span> : null}
|
|
|
|
</button>
|
|
|
|
);
|
|
|
|
}
|