import React from 'react';
import PropTypes from 'prop-types';
import { DatePicker, Select } from 'antd';
import locale from 'antd/es/date-picker/locale/zh_CN';
import 'moment/locale/zh-cn';
import useSettings from '../vm-hooks/useSettings';
import './style';
const { RangePicker } = DatePicker;
/**
 * 二次封装的日期选择器
 * @param props
 * @returns
 */
export const VMDatePicker = props => {
    const { theme } = useSettings();
    return (
        <RangePicker
            className={`vm-range-picker ${theme}`}
            dropdownClassName={`vm-range-picker-dropdown ${theme}`}
            allowClear={false}
            {...props}
            locale={locale}
        />
    );
};

export const VMSelect = props => {
    const { theme } = useSettings();
    return (
        <Select
            className={`vm-select ${theme}`}
            dropdownClassName={`vm-select-dropdown ${theme}`}
            {...props}
        >
            {props.children}
        </Select>
    );
};
VMSelect.propTypes = {
    children: PropTypes.element,
};
