mirror of
https://github.com/langgenius/dify.git
synced 2026-09-08 02:43:49 +08:00
63 lines
2.0 KiB
TypeScript
63 lines
2.0 KiB
TypeScript
'use client'
|
|
|
|
import { useTranslation } from 'react-i18next'
|
|
import { SearchInput } from '@/app/components/base/search-input'
|
|
import Category from '@/app/components/explore/category'
|
|
|
|
export function HomeTemplatesHeader({
|
|
allCategoriesEn,
|
|
categories,
|
|
currCategory,
|
|
keywords,
|
|
onCategoryChange,
|
|
onKeywordsChange,
|
|
}: {
|
|
allCategoriesEn: string
|
|
categories: string[]
|
|
currCategory: string
|
|
keywords: string
|
|
onCategoryChange: (category: string) => void
|
|
onKeywordsChange: (keywords: string) => void
|
|
}) {
|
|
const { t } = useTranslation()
|
|
|
|
return (
|
|
<div className="sticky top-0 z-10 bg-background-body">
|
|
<div className="flex items-center gap-2 px-8 pt-6">
|
|
<h2
|
|
id="home-templates-title"
|
|
className="min-w-0 flex-1 truncate system-xl-medium text-text-primary"
|
|
>
|
|
{t(($) => $['apps.title'], { ns: 'explore' })}
|
|
</h2>
|
|
<a
|
|
href="https://marketplace.dify.ai/templates"
|
|
target="_blank"
|
|
rel="noopener noreferrer"
|
|
className="-m-1 flex min-h-6 shrink-0 touch-manipulation items-center gap-1 rounded-md p-1 system-xs-medium text-text-tertiary outline-hidden transition-colors hover:text-text-secondary focus-visible:ring-2 focus-visible:ring-state-accent-solid motion-reduce:transition-none"
|
|
>
|
|
{t(($) => $['apps.viewMore'], { ns: 'explore' })}
|
|
<span className="i-ri-arrow-right-line size-3 shrink-0" aria-hidden="true" />
|
|
</a>
|
|
</div>
|
|
|
|
<div className="flex items-start justify-between gap-2 px-8 pt-3 pb-3">
|
|
<Category
|
|
className="min-w-0"
|
|
list={categories}
|
|
value={currCategory}
|
|
onChange={onCategoryChange}
|
|
allCategoriesEn={allCategoriesEn}
|
|
/>
|
|
<div className="flex shrink-0 items-center gap-3">
|
|
<SearchInput
|
|
className="w-40 shrink-0"
|
|
value={keywords}
|
|
onValueChange={onKeywordsChange}
|
|
/>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
)
|
|
}
|