diff --git a/components/tabs/TabBar.jsx b/components/tabs/TabBar.jsx new file mode 100644 index 000000000..70a76b9ba --- /dev/null +++ b/components/tabs/TabBar.jsx @@ -0,0 +1,58 @@ +import Icon from '../icon' +import ScrollableInkTabBar from '../vc-tabs/src/ScrollableInkTabBar' +import { cloneElement } from '../_util/vnode' + +const TabBar = { + functional: true, + render (h, context) { + const { + tabBarStyle, + animated = true, + renderTabBar, + tabBarExtraContent, + tabPosition, + prefixCls, + } = context.props + const inkBarAnimated = typeof animated === 'object' ? animated.inkBar : animated + + const isVertical = tabPosition === 'left' || tabPosition === 'right' + const prevIconType = isVertical ? 'up' : 'left' + const nextIconType = isVertical ? 'down' : 'right' + const prevIcon = ( + + + + ) + const nextIcon = ( + + + + ) + + const renderProps = { + props: { + ...context.props, + inkBarAnimated, + extraContent: tabBarExtraContent, + prevIcon, + nextIcon, + }, + style: tabBarStyle, + on: { + ...context.listeners, + }, + } + + let RenderTabBar + + if (renderTabBar) { + RenderTabBar = renderTabBar(renderProps, ScrollableInkTabBar) + } else { + RenderTabBar = + } + + return cloneElement(RenderTabBar, renderProps) + }, +} + +export default TabBar diff --git a/components/tree-select/__tests__/__snapshots__/demo.test.js.snap b/components/tree-select/__tests__/__snapshots__/demo.test.js.snap index 4e77849d7..1d75453ce 100644 --- a/components/tree-select/__tests__/__snapshots__/demo.test.js.snap +++ b/components/tree-select/__tests__/__snapshots__/demo.test.js.snap @@ -2,12 +2,12 @@ exports[`renders ./components/tree-select/demo/basic.md correctly 1`] = ` Please select + ant-select-selection--single">Please select `; exports[`renders ./components/tree-select/demo/checkable.md correctly 1`] = `
  • Node1
  • + ant-select-selection--multiple">
  • Node1
  • @@ -21,5 +21,5 @@ exports[`renders ./components/tree-select/demo/multiple.md correctly 1`] = ` exports[`renders ./components/tree-select/demo/treeData.md correctly 1`] = ` Please select + ant-select-selection--single">Please select `;