2024-07-17 19:07:34 +08:00
|
|
|
import { useSelectKnowledgeList } from '@/hooks/knowledge-hooks';
|
2024-04-30 18:43:26 +08:00
|
|
|
import { useState } from 'react';
|
|
|
|
|
|
|
|
|
|
export const useSearchKnowledge = () => {
|
|
|
|
|
const [searchString, setSearchString] = useState<string>('');
|
|
|
|
|
|
|
|
|
|
const handleInputChange = (e: React.ChangeEvent<HTMLInputElement>) => {
|
|
|
|
|
setSearchString(e.target.value);
|
|
|
|
|
};
|
|
|
|
|
return {
|
|
|
|
|
searchString,
|
|
|
|
|
handleInputChange,
|
|
|
|
|
};
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
export const useSelectKnowledgeListByKeywords = (keywords: string) => {
|
|
|
|
|
const list = useSelectKnowledgeList();
|
|
|
|
|
return list.filter((x) => x.name.includes(keywords));
|
|
|
|
|
};
|