import { SearchOutlined } from '@ant-design/icons'; import { Col, Empty, Row, Spin } from 'antd'; import React from 'react'; import '../style/search-result.less'; import HFModelItem from './hf-model-item'; interface SearchResultProps { resultList: any[]; onSelect?: (item: any) => void; current?: string; source?: string; style?: React.CSSProperties; loading?: boolean; } const SearchResult: React.FC = (props) => { const { resultList, onSelect, source } = props; const handleSelect = (e: any, item: any) => { e.stopPropagation(); onSelect?.(item); }; return (
{resultList.length ? ( {resultList.map((item, index) => (
handleSelect(e, item)}>
))}
) : ( !props.loading && ( } description="No models found" /> ) )}
); }; export default React.memo(SearchResult);