From b5db75f8ead2e8ffd6a99b3f7c6f06d79a344919 Mon Sep 17 00:00:00 2001 From: HeskeyBaozi Date: Thu, 16 Aug 2018 16:13:18 +0800 Subject: [PATCH] upgrade svg tabs prev & next icon --- components/icon/demo/iconfont.md | 4 +-- components/icon/index.tsx | 13 ++++---- components/tabs/index.tsx | 53 +++++++++++++++++++++----------- components/tabs/style/index.less | 16 +--------- 4 files changed, 44 insertions(+), 42 deletions(-) diff --git a/components/icon/demo/iconfont.md b/components/icon/demo/iconfont.md index 7e1cff40ce..f37588a402 100644 --- a/components/icon/demo/iconfont.md +++ b/components/icon/demo/iconfont.md @@ -7,7 +7,7 @@ title: ## zh-CN -对于使用 [iconfont.cn](http://iconfont.cn/) 的用户,通过设置 `create` 方法参数对象中的 `namespace` 和 `cdnUrl` 字段, 即可轻松地使用已有项目中的图标。 +对于使用 [iconfont.cn](http://iconfont.cn/) 的用户,通过设置 `createFromIconfontCN` 方法参数对象中的 `namespace` 和 `cdnUrl` 字段, 即可轻松地使用已有项目中的图标。 ## en-US @@ -16,7 +16,7 @@ Todo, please replace me! ````jsx import { Icon } from 'antd'; -const IconFont = Icon.create({ +const IconFont = Icon.createFromIconfontCN({ namespace: 'iconfont-foo', cdnUrl: 'at.alicdn.com/t/font_8d5l8fzk5b87iudi', prefix: 'icon-', diff --git a/components/icon/index.tsx b/components/icon/index.tsx index f6a1a62d9a..4cd2b4e4ef 100755 --- a/components/icon/index.tsx +++ b/components/icon/index.tsx @@ -40,7 +40,7 @@ const Icon: React.SFC = (props) => { // affect outter ... tag: Tag = 'i', title, - className = '', + className, onClick, style, @@ -63,15 +63,14 @@ const Icon: React.SFC = (props) => { 'Icon should have `type` prop or `component` prop or `children`.', ); - const classString = classNames( - { [`anticon`]: true, [`anticon-${type}`]: Boolean(type) }, - className, - ); + const classString = classNames({ + [`anticon`]: true, + [`anticon-${type}`]: Boolean(type), + }, className); const svgClassString = classNames({ - svgClassName, [`anticon-spin`]: !!spin || type === 'loading', - }); + }, svgClassName); const computedSvgStyle = getComputedSvgStyle( { rotate, flip }, diff --git a/components/tabs/index.tsx b/components/tabs/index.tsx index d304441095..db56320778 100755 --- a/components/tabs/index.tsx +++ b/components/tabs/index.tsx @@ -106,8 +106,8 @@ export default class Tabs extends React.Component { let { inkBarAnimated, tabPaneAnimated } = typeof animated === 'object' ? { inkBarAnimated: animated.inkBar, tabPaneAnimated: animated.tabPane, } : { - inkBarAnimated: animated, tabPaneAnimated: animated, - }; + inkBarAnimated: animated, tabPaneAnimated: animated, + }; // card tabs should not have animation if (type !== 'line') { @@ -133,11 +133,11 @@ export default class Tabs extends React.Component { let closable = child.props.closable; closable = typeof closable === 'undefined' ? true : closable; const closeIcon = closable ? ( - this.removeTab(child.key as string, e)} - /> + this.removeTab(child.key as string, e)} + /> ) : null; childrenWithClose.push(React.cloneElement(child, { tab: ( @@ -166,17 +166,34 @@ export default class Tabs extends React.Component { ) : null; - const renderTabBar = () => ( - - ); + const renderTabBar = () => { + const isVertical = tabPosition === 'left' || tabPosition === 'right'; + const prevIconType = isVertical ? 'up' : 'left'; + const nextIconType = isVertical ? 'down' : 'right'; + const prevIcon = ( + + + + ); + const nextIcon = ( + + + + ); + return ( + + ); + }; return (