ant-design/components/input/Group.tsx

35 lines
762 B
TypeScript
Raw Normal View History

2016-09-21 11:54:53 +08:00
import React from 'react';
2016-03-31 17:46:35 +08:00
import classNames from 'classnames';
export interface GroupProps {
className?: string;
2016-08-22 17:26:14 +08:00
size?: 'large' | 'small' | 'default';
children?: any;
style?: React.CSSProperties;
prefixCls?: string;
}
2016-08-22 17:26:14 +08:00
const Group: React.StatelessComponent<GroupProps> = (props) => {
const className = classNames({
[props.prefixCls]: true,
[`${props.prefixCls}-lg`]: props.size === 'large',
[`${props.prefixCls}-sm`]: props.size === 'small',
[props.className]: !!props.className,
});
return (
<span className={className} style={props.style}>
{props.children}
</span>
);
2016-08-22 17:26:14 +08:00
};
Group.propTypes = {
children: React.PropTypes.any,
};
2016-08-22 17:26:14 +08:00
Group.defaultProps = {
prefixCls: 'ant-input-group',
};
2016-08-22 17:26:14 +08:00
export default Group;