// eslint-disable-next-line no-unused-vars
import React, { useContext } from 'react';
import classNames from 'classnames';
import { Select, TreeSelect, ConfigProvider } from 'antd';
import './index.less';

const { Option, OptGroup } = Select;
const { SHOW_PARENT } = TreeSelect;
const SelectCustom = (props) => {
  const { getPrefixCls } = useContext(ConfigProvider.ConfigContext);
  const prefixCls = getPrefixCls('select-custom');

  return (
    <div className={classNames(`${prefixCls}`, props.prefixIcon ? `${prefixCls}-prefix` : '')}>
      {props.prefixIcon ? (
        <div className={classNames(`${prefixCls}-icon`)} style={props.prefixStyle}>
          {props.prefixIcon}
        </div>
      ) : null}
      <Select
        {...props}
        className={classNames(`${prefixCls}-base`, props.className || '')}
        popupClassName={classNames(`${prefixCls}-base-poup`, props.popupClassName || '')}
      ></Select>
    </div>
  );
};

const TreeSelectCustom = (props) => {
  const { getPrefixCls } = useContext(ConfigProvider.ConfigContext);
  const prefixCls = getPrefixCls('tree-select-custom');

  return (
    <TreeSelect {...props} className={classNames(`${prefixCls}-base`, props.className || '')} />
  );
};

export { SelectCustom, TreeSelectCustom, Option, OptGroup, SHOW_PARENT };
