ConceptPortal-public/rsconcept/frontend/src/components/Navigation/NavigationButton.tsx

38 lines
834 B
TypeScript
Raw Normal View History

import clsx from 'clsx';
2023-12-21 00:12:24 +03:00
import { globalIDs } from '@/utils/constants';
2023-07-15 17:46:19 +03:00
interface NavigationButtonProps {
2023-12-28 14:04:44 +03:00
text?: string;
icon: React.ReactNode;
title?: string;
onClick?: () => void;
2023-07-15 17:46:19 +03:00
}
2023-12-21 00:12:24 +03:00
function NavigationButton({ icon, title, 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}
data-tooltip-id={title ? globalIDs.tooltip : undefined}
data-tooltip-content={title}
onClick={onClick}
className={clsx(
'mr-1 h-full', //
'flex items-center gap-1',
'clr-btn-nav',
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
}
)}
>
{icon ? <span>{icon}</span> : null}
2023-12-30 19:43:24 +03:00
{text ? <span>{text}</span> : null}
2023-12-28 14:04:44 +03:00
</button>
);
2023-07-15 17:46:19 +03:00
}
2023-12-28 14:04:44 +03:00
export default NavigationButton;