Initial commit
This commit is contained in:
49
src/views/Community/components/SearchBox.js
Normal file
49
src/views/Community/components/SearchBox.js
Normal file
@@ -0,0 +1,49 @@
|
||||
// src/views/Community/components/SearchBox.js
|
||||
import React from 'react';
|
||||
import { Card, Input, Radio, Form, Button } from 'antd';
|
||||
import { SearchOutlined } from '@ant-design/icons';
|
||||
|
||||
const SearchBox = ({ onSearch }) => {
|
||||
const [form] = Form.useForm();
|
||||
|
||||
const handleSubmit = (values) => {
|
||||
onSearch(values);
|
||||
};
|
||||
|
||||
return (
|
||||
<Card title="搜索事件" className="search-box" style={{ marginBottom: 16 }}>
|
||||
<Form
|
||||
form={form}
|
||||
onFinish={handleSubmit}
|
||||
initialValues={{ search_type: 'topic' }}
|
||||
>
|
||||
<Form.Item name="q" style={{ marginBottom: 12 }}>
|
||||
<Input.Search
|
||||
placeholder="搜索关键词..."
|
||||
allowClear
|
||||
enterButton={<SearchOutlined />}
|
||||
onSearch={(value) => {
|
||||
form.setFieldsValue({ q: value });
|
||||
form.submit();
|
||||
}}
|
||||
/>
|
||||
</Form.Item>
|
||||
|
||||
<Form.Item name="search_type" style={{ marginBottom: 12 }}>
|
||||
<Radio.Group>
|
||||
<Radio value="topic">搜索话题</Radio>
|
||||
<Radio value="stock">搜索股票</Radio>
|
||||
</Radio.Group>
|
||||
</Form.Item>
|
||||
|
||||
<Form.Item style={{ marginBottom: 0 }}>
|
||||
<Button type="primary" htmlType="submit" block>
|
||||
搜索
|
||||
</Button>
|
||||
</Form.Item>
|
||||
</Form>
|
||||
</Card>
|
||||
);
|
||||
};
|
||||
|
||||
export default SearchBox;
|
||||
Reference in New Issue
Block a user