import ConfigProvider from '../config-provider'; import React, { Component } from 'react'; import hoistNonReactStatics from 'hoist-non-react-statics'; import { Button as NextButton } from '@alifd/next'; import { ButtonProps as NextButtonProps } from '@alifd/next/types/button'; interface ButtonProps extends Omit { size?: 'xl' | 'large' | 'medium' | 'small' | 'xs'; icon?: boolean; } class Button extends Component { static Group = NextButton.Group; render() { const { size, warning, icon, className = '', prefix = 'next-' } = this.props; // 警告按钮就取默认type let type = this.props.type; if (warning) { type = undefined; } else if (icon) { if (this.props.type === 'primary') { type = 'secondary'; } } // xl/xs 模式 if (size === 'xl' || size === 'xs') { const { size, ...otherProps } = this.props; return ( ); } return ( ); } } hoistNonReactStatics(Button, NextButton); // export default Button; export default ConfigProvider.config(Button);