index.tsx 913 B

123456789101112131415161718192021222324252627282930313233343536
  1. 'use client'
  2. import { useTranslation } from 'react-i18next'
  3. import Link from 'next/link'
  4. import { useSelectedLayoutSegment } from 'next/navigation'
  5. import classNames from 'classnames'
  6. import { Tools, ToolsActive } from '../../base/icons/src/public/header-nav/tools'
  7. type ToolsNavProps = {
  8. className?: string
  9. }
  10. const ToolsNav = ({
  11. className,
  12. }: ToolsNavProps) => {
  13. const { t } = useTranslation()
  14. const selectedSegment = useSelectedLayoutSegment()
  15. const actived = selectedSegment === 'tools'
  16. return (
  17. <Link href="/tools" className={classNames(
  18. className, 'group',
  19. actived && 'bg-white shadow-md',
  20. actived ? 'text-primary-600' : 'text-gray-500 hover:bg-gray-200',
  21. )}>
  22. {
  23. actived
  24. ? <ToolsActive className='mr-2 w-4 h-4' />
  25. : <Tools className='mr-2 w-4 h-4' />
  26. }
  27. {t('common.menus.tools')}
  28. </Link>
  29. )
  30. }
  31. export default ToolsNav