index.tsx 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738
  1. 'use client'
  2. import { useTranslation } from 'react-i18next'
  3. import Link from 'next/link'
  4. import { useSelectedLayoutSegment } from 'next/navigation'
  5. import {
  6. RiCpuFill,
  7. RiCpuLine,
  8. } from '@remixicon/react'
  9. import classNames from '@/utils/classnames'
  10. type ToolsNavProps = {
  11. className?: string
  12. }
  13. const SkillNav = ({ className }: ToolsNavProps) => {
  14. const { t } = useTranslation()
  15. const selectedSegment = useSelectedLayoutSegment()
  16. const activated = selectedSegment === 'skill'
  17. return (
  18. <Link href="/skill" className={classNames(
  19. 'group text-sm font-medium',
  20. activated && 'font-semibold bg-components-main-nav-nav-button-bg-active hover:bg-components-main-nav-nav-button-bg-active-hover shadow-md',
  21. activated ? 'text-components-main-nav-nav-button-text-active' : 'text-components-main-nav-nav-button-text hover:bg-components-main-nav-nav-button-bg-hover',
  22. className,
  23. )}>
  24. {
  25. activated
  26. ? <RiCpuFill className='mr-2 h-4 w-4' />
  27. : <RiCpuLine className='mr-2 h-4 w-4' />
  28. }
  29. {t('common.menus.skill')}
  30. </Link>
  31. )
  32. }
  33. export default SkillNav