import ConfigProvider from '../config-provider';
import React, { Component } from 'react';
import cls from 'classnames';
import hoistNonReactStatics from 'hoist-non-react-statics';
import { Range as NextRange } from '@alifd/next';
import { RangeProps as NextRangeProps } from '@alifd/next/types/range';

interface RangeProps extends NextRangeProps {
  size?: 'large' | 'medium' | 'small';
}
class Range extends Component<RangeProps> {

  render() {
    const { size = 'medium' } = this.props;
    const { prefix = 'next-', className, ...otherProps } = this.props;
    return (
      <NextRange
        {...otherProps}
        prefix={prefix}
        className={cls(className, {
          [`${prefix}large`]: size === 'large',
          [`${prefix}medium`]: size === 'medium',
          [`${prefix}small`]: size === 'small',
        })}
      />
    );
  }
}
hoistNonReactStatics(Range, NextRange);
export default ConfigProvider.config(Range);
