index.tsx 1.0 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. RiPlanetFill,
  7. RiPlanetLine,
  8. } from '@remixicon/react'
  9. import classNames from '@/utils/classnames'
  10. type ExploreNavProps = {
  11. className?: string
  12. }
  13. const ExploreNav = ({
  14. className,
  15. }: ExploreNavProps) => {
  16. const { t } = useTranslation()
  17. const selectedSegment = useSelectedLayoutSegment()
  18. const activated = selectedSegment === 'explore'
  19. return (
  20. <Link href="/explore/apps" className={classNames(
  21. className, 'group',
  22. activated && 'bg-components-main-nav-nav-button-bg-active shadow-md',
  23. 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',
  24. )}>
  25. {
  26. activated
  27. ? <RiPlanetFill className='mr-2 w-4 h-4' />
  28. : <RiPlanetLine className='mr-2 w-4 h-4' />
  29. }
  30. {t('common.menus.explore')}
  31. </Link>
  32. )
  33. }
  34. export default ExploreNav