import { IconLink } from '@material-hu/icons/tabler';

import HuSidebarNavItem from '@material-hu/components/design-system/Sidebar/components/NavItem';

import { useLokaliseTranslation } from 'src/utils/i18n';

import itemsConfig from '../constants';
import useGetSidebarIcon from '../hooks/useSidebarIcon';
import { SidebarItemProps } from '../types';

const { key, titleTranslationKey } = itemsConfig.widgets;

const NavShortcutItem = (props: SidebarItemProps) => {
  const { isCollapsed, onClick, isActive: isShortcutActive = false } = props;
  const { t } = useLokaliseTranslation('dashboard_sidebar_app');

  const { Icon } = useGetSidebarIcon({
    defaultIcon: IconLink,
    key: 'Quick Links',
  });

  return (
    <HuSidebarNavItem
      key={key}
      depth={0}
      title={t(titleTranslationKey)}
      icon={<Icon />}
      path=""
      isCollapsed={isCollapsed}
      onClick={onClick}
      active={isShortcutActive}
      skipLinkBehavior
    />
  );
};

export default NavShortcutItem;
