dify/web/app/components/header/plugins-nav/index.tsx

38 lines
1.2 KiB
TypeScript
Raw Normal View History

2024-09-14 17:09:25 +08:00
'use client'
import { useTranslation } from 'react-i18next'
import Link from 'next/link'
import classNames from '@/utils/classnames'
import { Group } from '@/app/components/base/icons/src/vender/other'
2024-11-14 18:26:16 +08:00
import { useSelectedLayoutSegment } from 'next/navigation'
2024-09-14 17:09:25 +08:00
type PluginsNavProps = {
className?: string
}
const PluginsNav = ({
className,
}: PluginsNavProps) => {
const { t } = useTranslation()
2024-11-14 18:26:16 +08:00
const selectedSegment = useSelectedLayoutSegment()
const activated = selectedSegment === 'plugins'
2024-09-14 17:09:25 +08:00
return (
<Link href="/plugins" className={classNames(
className, 'group',
)}>
2024-11-14 18:26:16 +08:00
<div className={`flex flex-row h-8 p-1.5 gap-0.5 items-center justify-center
rounded-xl system-sm-medium-uppercase ${activated
? 'border border-components-main-nav-nav-button-border bg-components-main-nav-nav-button-bg-active shadow-md text-components-main-nav-nav-button-text'
: 'text-text-tertiary hover:bg-state-base-hover hover:text-text-secondary'}`}>
2024-12-12 17:29:25 +08:00
<div className='flex mr-0.5 w-5 h-5 justify-center items-center'>
<Group className='w-4 h-4' />
2024-09-14 17:09:25 +08:00
</div>
<span className='px-0.5'>{t('common.menus.plugins')}</span>
</div>
</Link>
)
}
export default PluginsNav