广州矛调粤政易端
xusd
7 days ago d27794814b69d18aeb8ee96a46cae91d5613570c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
/*
 * @Company: hugeInfo
 * @Author: ldh
 * @Date: 2022-08-09 15:52:45
 * @LastEditTime: 2023-10-26 17:16:40
 * @LastEditors: dminyi 1301963064@qq.com
 * @Version: 1.0.0
 * @Description: 搜索栏
 */
import React from 'react';
import { SearchOutlined, FilterOutlined } from 'dd-icons';
import './index.less';
 
/**
 * onOpenSearch: func // 点击搜索回调
 * onClickRightAction: func // 点击右侧按钮回调
 * isRightActive: bool // 是否执行了右侧按钮
 */
const MySearch = ({ onOpenSearch, value, onClickRightAction, isRightActive = false, showButton = true,buttonTitle = '搜索',showFilterOutlined=false }) => {
  
  return (
    <div className="mySearchBar">
      <div className="mySearchBar-search" onClick={onOpenSearch}>
        <SearchOutlined />
        <span>{value || '搜索'}</span>
      </div>
      {
        showButton &&
        <div style={{ marginLeft: '16px' }} className={`mySearchBar-scan ${isRightActive && 'mySearchBar-scan-active'}`} onClick={onClickRightAction}>
          {
            showFilterOutlined &&
          <FilterOutlined className="mySearchBar-scan-icon" />
          }
          <span>{buttonTitle}</span>
        </div>
      }
 
    </div>
  );
};
 
export default MySearch;