ant-design/components/input/Group.tsx

32 lines
740 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) => {
2016-10-24 12:04:26 +08:00
const { prefixCls = 'ant-input-group', className = '' } = props;
const cls = classNames({
[prefixCls]: true,
[`${props.prefixCls}-lg`]: props.size === 'large',
[`${props.prefixCls}-sm`]: props.size === 'small',
2016-10-24 12:04:26 +08:00
[className]: !!className,
});
return (
2016-10-24 12:04:26 +08:00
<span className={cls} 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
export default Group;