diff --git a/components/result/__tests__/__snapshots__/demo.test.js.snap b/components/result/__tests__/__snapshots__/demo.test.js.snap index cb0fac80f3..0a0a26dd24 100644 --- a/components/result/__tests__/__snapshots__/demo.test.js.snap +++ b/components/result/__tests__/__snapshots__/demo.test.js.snap @@ -143,7 +143,7 @@ exports[`renders ./components/result/demo/basic.md correctly 1`] = `

{ const wrapper = mount(); expect(wrapper.find('.ant-result-extra')).toHaveLength(0); }); + + it('🙂 result should support className', () => { + const wrapper = mount(); + expect(wrapper.find('.ant-result.my-result')).toHaveLength(1); + }); }); diff --git a/components/result/index.tsx b/components/result/index.tsx index cc3f3d270d..05f56e643c 100644 --- a/components/result/index.tsx +++ b/components/result/index.tsx @@ -69,17 +69,17 @@ export const OriginResult: React.SFC = props => ( {({ getPrefixCls }: ConfigConsumerProps) => { const { prefixCls: customizePrefixCls, - className, + className: customizeClassName, subTitle, title, style, children, status, } = props; - const prefixCls = getPrefixCls('result', customizePrefixCls); + const className = classnames(prefixCls, `${prefixCls}-${status}`, customizeClassName); return ( -
+
{renderIcon(prefixCls, props)}
{title}
{subTitle &&
{subTitle}
} diff --git a/components/result/style/index.less b/components/result/style/index.less index 63eb8105bf..feaa6d1411 100644 --- a/components/result/style/index.less +++ b/components/result/style/index.less @@ -5,22 +5,20 @@ .@{result-prefix-cls} { padding: 48px 32px; - background-color: @component-background; - // status color - &-success .anticon { + &-success &-icon > .anticon { color: @success-color; } - &-error .anticon { + &-error &-icon > .anticon { color: @error-color; } - &-info .anticon { + &-info &-icon > .anticon { color: @info-color; } - &-warning .anticon { + &-warning &-icon > .anticon { color: @warning-color; }