import React from 'react'
import styles from './index.module.less'
import { useStore } from '../../store'

import { Tag } from 'antd'

const SavedSearchParamsToggleBtn: React.FC = () => {
  const [store, useObserver] = useStore()

  const { switchShowType } = store.savedSearchParams

  return useObserver(() => {
    const { showType } = store.savedSearchParams

    return (
      <Tag
        className={styles['saved-search-params-toggle-btn']}
        color="#1890ff"
        onClick={switchShowType}
      >
        {showType === 'saved' ? '查看历史搜索条件' : '查看已保存搜索条件'}
      </Tag>
    )
  })
}

export default SavedSearchParamsToggleBtn
