From 75fc99f0adb4fab3ee8781ce709bfbe8d5899597 Mon Sep 17 00:00:00 2001 From: Benjy Cui Date: Wed, 25 Nov 2015 15:46:44 +0800 Subject: [PATCH] fix: InputNumber should support `className` --- components/input-number/index.jsx | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/components/input-number/index.jsx b/components/input-number/index.jsx index ad14782ea6..c9d919698b 100644 --- a/components/input-number/index.jsx +++ b/components/input-number/index.jsx @@ -1,5 +1,6 @@ -import InputNumber from 'rc-input-number'; import React from 'react'; +import classNames from 'classnames'; +import InputNumber from 'rc-input-number'; export default React.createClass({ getDefaultProps() { @@ -9,12 +10,13 @@ export default React.createClass({ }; }, render() { - let sizeClass = ''; - if (this.props.size === 'large') { - sizeClass = 'ant-input-number-lg'; - } else if (this.props.size === 'small') { - sizeClass = 'ant-input-number-sm'; - } - return ; + const {className, size, ...other} = this.props; + const inputNumberClass = classNames({ + 'ant-input-number-lg': size === 'large', + 'ant-input-number-sm': size === 'small', + [className]: !!className, + }); + + return ; } });