ant-design/components/tabs/index.jsx

32 lines
912 B
React
Raw Normal View History

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') {
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',
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
export default AntTabs;