// import { Calendar2 } from '@alifd/next';
// export default Calendar2;

import ConfigProvider from '../config-provider';
import PropTypes from 'prop-types';
import React, { Component } from 'react';
import cls from 'classnames';
import { CommonThemeProps } from '../types';
import { Calendar2 as NextCalendar2 } from '@alifd/next';
import { CalendarProps as NextCalendar2Props } from '@alifd/next/types/calendar2';
import { getTheme } from '../utils/getTheme';

interface CalendarProps extends NextCalendar2Props, CommonThemeProps { }
class Calendar2 extends Component<CalendarProps> {

  // contextTypes
  static contextTypes = {
    theme: PropTypes.string,
  };

  render() {
    const {
      prefix = 'next-',
      className,
      ...otherProps
    } = this.props;

    const theme = getTheme(this.context, this.props);

    return (
      <NextCalendar2
        {...otherProps}
        prefix={prefix}
        className={cls(className, {
          [`${prefix}white`]: theme === 'white',
          [`${prefix}grey`]: theme === 'grey',
        })}
      />
    );
  }
}
export default ConfigProvider.config(Calendar2);
