index.tsx 942 B

1234567891011121314151617181920212223242526272829303132333435
  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 { Explore, ExploreActive } from '../../base/icons/src/public/header-nav/explore'
  7. type ExploreNavProps = {
  8. className?: string
  9. }
  10. const ExploreNav = ({
  11. className,
  12. }: ExploreNavProps) => {
  13. const { t } = useTranslation()
  14. const selectedSegment = useSelectedLayoutSegment()
  15. const actived = selectedSegment === 'explore'
  16. return (
  17. <Link href="/explore/apps" 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. ? <ExploreActive className='mr-2 w-4 h-4' />
  25. : <Explore className='mr-2 w-4 h-4' />
  26. }
  27. {t('common.menus.explore')}
  28. </Link>
  29. )
  30. }
  31. export default ExploreNav