From a59bcf7e90ea66234eccba87ed23afab911ec4f1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=81=8F=E5=8F=B3?= Date: Mon, 14 Aug 2017 09:52:16 +0800 Subject: [PATCH] change noHovering to true defaultly (#7178) --- .../card/__tests__/__snapshots__/demo.test.js.snap | 12 ++++++------ components/card/demo/grid-card.md | 2 +- components/card/demo/inner.md | 2 +- components/card/demo/meta.md | 1 + components/card/demo/no-padding.md | 2 +- components/card/index.en-US.md | 2 +- components/card/index.tsx | 4 ++-- components/card/index.zh-CN.md | 2 +- components/card/style/index.less | 9 ++++++--- 9 files changed, 20 insertions(+), 16 deletions(-) diff --git a/components/card/__tests__/__snapshots__/demo.test.js.snap b/components/card/__tests__/__snapshots__/demo.test.js.snap index c9127ec532..06dfb2df0a 100644 --- a/components/card/__tests__/__snapshots__/demo.test.js.snap +++ b/components/card/__tests__/__snapshots__/demo.test.js.snap @@ -83,7 +83,7 @@ exports[`renders ./components/card/demo/border-less.md correctly 1`] = ` exports[`renders ./components/card/demo/grid-card.md correctly 1`] = `
@@ -409,7 +409,7 @@ exports[`renders ./components/card/demo/loading.md correctly 1`] = ` exports[`renders ./components/card/demo/meta.md correctly 1`] = `
@@ -497,7 +497,7 @@ exports[`renders ./components/card/demo/meta.md correctly 1`] = ` exports[`renders ./components/card/demo/no-padding.md correctly 1`] = `
diff --git a/components/card/demo/grid-card.md b/components/card/demo/grid-card.md index 255fc63204..b79d89cc59 100644 --- a/components/card/demo/grid-card.md +++ b/components/card/demo/grid-card.md @@ -22,7 +22,7 @@ const gridStyle = { }; ReactDOM.render( - + Content Content Content diff --git a/components/card/demo/inner.md b/components/card/demo/inner.md index 8a5013a971..d4be084af0 100644 --- a/components/card/demo/inner.md +++ b/components/card/demo/inner.md @@ -17,7 +17,7 @@ It can be placed inside the ordinary card to display the information of the mult import { Card } from 'antd'; ReactDOM.render( - +

} actions={[, , ]} + noHovering={false} > } diff --git a/components/card/demo/no-padding.md b/components/card/demo/no-padding.md index 177ff78c03..e6a9d9f402 100644 --- a/components/card/demo/no-padding.md +++ b/components/card/demo/no-padding.md @@ -18,7 +18,7 @@ Customizing default width and margin. import { Card } from 'antd'; ReactDOM.render( - +

example
diff --git a/components/card/index.en-US.md b/components/card/index.en-US.md index 74cf5f81f9..c0bead843a 100644 --- a/components/card/index.en-US.md +++ b/components/card/index.en-US.md @@ -25,7 +25,7 @@ A card can be used to display content related to a single subject. The content c | extra | Content to render in the top-right corner of the card | string\|ReactNode | - | | bordered | Toggles rendering of the border around the card | boolean | true | | bodyStyle | Inline style to apply to the card content | object | - | -| noHovering | Whether to be disable hovering when mouse over | boolean | false, and is set to true when [type='inner'] | +| noHovering | Don't lift up when hovering card | boolean | true | | loading | Shows a loading indicator while the contents of the card are being fetched | boolean | false | | type | Card style type, can be set to `inner` or not set | string | - | | cover | Card cover | ReactNode | - | diff --git a/components/card/index.tsx b/components/card/index.tsx index 910e71faaf..247ae75292 100644 --- a/components/card/index.tsx +++ b/components/card/index.tsx @@ -101,14 +101,14 @@ export default class Card extends Component { } render() { const { - prefixCls = 'ant-card', className, extra, bodyStyle, noHovering, title, loading, + prefixCls = 'ant-card', className, extra, bodyStyle, noHovering = true, title, loading, bordered = true, type, cover, actions, tabList, children, ...others, } = this.props; const classString = classNames(prefixCls, className, { [`${prefixCls}-loading`]: loading, [`${prefixCls}-bordered`]: bordered, - [`${prefixCls}-no-hovering`]: noHovering || (type === 'inner' && noHovering === undefined), + [`${prefixCls}-hovering`]: !noHovering, [`${prefixCls}-wider-padding`]: this.state.widerPadding, [`${prefixCls}-padding-transition`]: this.updateWiderPaddingCalled, [`${prefixCls}-contain-grid`]: this.isContainGrid(), diff --git a/components/card/index.zh-CN.md b/components/card/index.zh-CN.md index aef86826af..f1a2574100 100644 --- a/components/card/index.zh-CN.md +++ b/components/card/index.zh-CN.md @@ -26,7 +26,7 @@ cols: 1 | extra | 卡片右上角的操作区域 | string\|ReactNode | - | | bordered | 是否有边框 | boolean | true | | bodyStyle | 内容区域自定义样式 | object | - | -| noHovering | 取消鼠标移过浮起 | boolean | false,[type='inner'] 时默认为 true | +| noHovering | 鼠标移过时不浮起,设为 `false` 可浮起 | boolean | true | | loading | 当卡片内容还在加载中时,可以用 loading 展示一个占位 | boolean | false | | type | 卡片类型,可设置为 `inner` 或 不设置 | string | - | | cover | 卡片封面 | ReactNode | - | diff --git a/components/card/style/index.less b/components/card/style/index.less index 6f3f59a69e..829c3c2ea5 100644 --- a/components/card/style/index.less +++ b/components/card/style/index.less @@ -12,9 +12,12 @@ position: relative; transition: all .3s; - &:not(&-no-hovering):hover { - box-shadow: @box-shadow-base; - border-color: transparent; + &-hovering { + cursor: pointer; + &:hover { + box-shadow: @box-shadow-base; + border-color: transparent; + } } &-bordered {