2015-07-23 22:23:11 +08:00
|
|
|
import Tabs from 'rc-tabs';
|
|
|
|
import React from 'react';
|
2015-12-14 16:30:15 +08:00
|
|
|
import classNames from 'classnames';
|
2015-06-12 12:01:02 +08:00
|
|
|
|
|
|
|
class AntTabs extends React.Component {
|
|
|
|
render() {
|
2015-12-14 16:30:15 +08:00
|
|
|
let { prefixCls, size, tabPosition, animation, type } = this.props;
|
|
|
|
let className = classNames({
|
|
|
|
[this.props.className]: !!this. props.className,
|
|
|
|
[prefixCls + '-mini']: size === 'small' || size === 'mini',
|
|
|
|
[prefixCls + '-vertical']: tabPosition === 'left' || tabPosition === 'right',
|
|
|
|
[prefixCls + '-' + type]: true,
|
|
|
|
});
|
|
|
|
if (tabPosition === 'left' || tabPosition === 'right' || type === 'card') {
|
2015-12-02 18:06:16 +08:00
|
|
|
animation = null;
|
2015-10-21 19:58:54 +08:00
|
|
|
}
|
2015-12-14 16:30:15 +08:00
|
|
|
return <Tabs {...this.props} className={className} animation={animation} />;
|
2015-06-12 12:01:02 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
AntTabs.defaultProps = {
|
2015-12-14 16:30:15 +08:00
|
|
|
prefixCls: 'ant-tabs',
|
2015-12-02 18:06:16 +08:00
|
|
|
size: 'default',
|
|
|
|
animation: 'slide-horizontal',
|
2015-12-14 16:30:15 +08:00
|
|
|
type: 'line', // or 'card',
|
|
|
|
closable: false,
|
2015-06-12 12:01:02 +08:00
|
|
|
};
|
|
|
|
|
2015-06-15 19:56:58 +08:00
|
|
|
AntTabs.TabPane = Tabs.TabPane;
|
2015-06-12 12:01:02 +08:00
|
|
|
|
2015-07-23 22:23:11 +08:00
|
|
|
export default AntTabs;
|