39 lines
1.0 KiB
TypeScript
Raw Permalink Normal View History

2023-07-18 16:57:14 +08:00
'use client'
import { useTranslation } from 'react-i18next'
import Link from 'next/link'
import { useSelectedLayoutSegment } from 'next/navigation'
2024-06-20 11:05:08 +08:00
import {
RiPlanetFill,
RiPlanetLine,
} from '@remixicon/react'
import classNames from '@/utils/classnames'
2023-07-18 16:57:14 +08:00
type ExploreNavProps = {
className?: string
}
const ExploreNav = ({
className,
}: ExploreNavProps) => {
const { t } = useTranslation()
const selectedSegment = useSelectedLayoutSegment()
2024-09-08 12:14:11 +07:00
const activated = selectedSegment === 'explore'
2023-07-18 16:57:14 +08:00
return (
<Link href="/explore/apps" className={classNames(
className, 'group',
2024-09-08 12:14:11 +07:00
activated && 'bg-components-main-nav-nav-button-bg-active shadow-md',
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',
2023-07-18 16:57:14 +08:00
)}>
{
2024-09-08 12:14:11 +07:00
activated
2024-06-20 11:05:08 +08:00
? <RiPlanetFill className='mr-2 w-4 h-4' />
: <RiPlanetLine className='mr-2 w-4 h-4' />
2023-07-18 16:57:14 +08:00
}
{t('common.menus.explore')}
</Link>
)
}
export default ExploreNav