origin/apps/web/src/app/main/library/components/SearchBar.tsx

47 lines
1.2 KiB
TypeScript

import { Button, Input, Space } from 'antd';
import { SearchOutlined, PlusOutlined } from '@ant-design/icons';
import React from 'react';
import { ImportExportButtons } from './ImportExportButtons';
import { Library } from './types';
interface SearchBarProps {
searchText: string;
onSearchTextChange: (text: string) => void;
onSearch: () => void;
onAdd: () => void;
onImportSuccess: () => void;
data: Library[];
}
export const SearchBar: React.FC<SearchBarProps> = ({
searchText,
onSearchTextChange,
onSearch,
onAdd,
onImportSuccess,
data,
}) => {
return (
<div className="mb-4 flex justify-between">
<Space>
<Input
placeholder="搜索图书馆"
value={searchText}
onChange={(e) => onSearchTextChange(e.target.value)}
onPressEnter={onSearch}
prefix={<SearchOutlined />}
/>
<Button type="primary" onClick={onSearch}></Button>
</Space>
<Space>
<ImportExportButtons
onImportSuccess={onImportSuccess}
data={data}
/>
<Button type="primary" icon={<PlusOutlined />} onClick={onAdd}>
</Button>
</Space>
</div>
);
};