ConceptPortal-public/rsconcept/frontend/src/app/navigation/navigation-button.tsx

39 lines
1.0 KiB
TypeScript
Raw Normal View History

import clsx from 'clsx';
import { type Styling } from '@/components/props';
2025-02-20 18:10:53 +03:00
import { globalIDs } from '@/utils/constants';
2023-12-21 00:12:24 +03:00
interface NavigationButtonProps extends Styling {
2023-12-28 14:04:44 +03:00
text?: string;
title?: string;
hideTitle?: boolean;
2023-12-28 14:04:44 +03:00
icon: React.ReactNode;
2025-02-22 14:04:01 +03:00
onClick?: (event: React.MouseEvent<Element>) => void;
2023-07-15 17:46:19 +03:00
}
export function NavigationButton({ icon, title, hideTitle, className, style, 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}
aria-label={title}
data-tooltip-id={!!title ? globalIDs.tooltip : undefined}
data-tooltip-hidden={hideTitle}
2023-12-28 14:04:44 +03:00
data-tooltip-content={title}
onClick={onClick}
className={clsx(
2025-03-09 21:59:21 +03:00
'p-2 flex items-center gap-1',
'cursor-pointer',
2024-12-20 11:54:38 +03:00
'clr-btn-nav cc-animate-color duration-500',
'rounded-xl',
2023-12-30 19:43:24 +03:00
'font-controls whitespace-nowrap',
className
2023-12-28 14:04:44 +03:00
)}
style={style}
2023-12-28 14:04:44 +03:00
>
2025-03-09 21:59:21 +03:00
{icon ? icon : 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
}