Files
dify/web/app/components/workflow/skill/start-tab/template-search.tsx
yyh abe2b37e3a fix(skill): use SearchInput with debounce and align card to Figma
Replace custom search input with SearchInput component (built-in clear
button) and add 300ms debounce. Fix template card: use Tailwind token
for icon background, fix Badge to use children with badge-s class and
uppercase, match empty-tag fallback height to badge size.
2026-01-30 16:10:18 +08:00

35 lines
859 B
TypeScript

'use client'
import { useDebounceFn } from 'ahooks'
import { memo, useCallback, useState } from 'react'
import { useTranslation } from 'react-i18next'
import SearchInput from '@/app/components/base/search-input'
type TemplateSearchProps = {
onChange: (value: string) => void
}
const TemplateSearch = ({
onChange,
}: TemplateSearchProps) => {
const { t } = useTranslation('workflow')
const [localValue, setLocalValue] = useState('')
const { run: debouncedOnChange } = useDebounceFn(onChange, { wait: 300 })
const handleChange = useCallback((v: string) => {
setLocalValue(v)
debouncedOnChange(v)
}, [debouncedOnChange])
return (
<SearchInput
className="!h-7"
placeholder={t('skill.startTab.searchPlaceholder')}
value={localValue}
onChange={handleChange}
/>
)
}
export default memo(TemplateSearch)