Skip to content

Commit

Permalink
Merge pull request #17389 from ant-design/fix-className-undefined
Browse files Browse the repository at this point in the history
fix: fix classname is undefined
  • Loading branch information
chenshuai2144 committed Jul 2, 2019
2 parents 2ef8d77 + 2c4976b commit f096b89
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 12 deletions.
6 changes: 3 additions & 3 deletions components/result/__tests__/__snapshots__/demo.test.js.snap
Expand Up @@ -143,7 +143,7 @@ exports[`renders ./components/result/demo/basic.md correctly 1`] = `
</div>
<p />
<div
class="ant-result ant-result-403 undefined"
class="ant-result ant-result-403"
>
<div
class="ant-result-icon ant-result-image"
Expand Down Expand Up @@ -457,7 +457,7 @@ exports[`renders ./components/result/demo/basic.md correctly 1`] = `

exports[`renders ./components/result/demo/complex.md correctly 1`] = `
<div
class="ant-result ant-result-error undefined"
class="ant-result ant-result-error"
>
<div
class="ant-result-icon"
Expand Down Expand Up @@ -591,7 +591,7 @@ exports[`renders ./components/result/demo/complex.md correctly 1`] = `

exports[`renders ./components/result/demo/customIcon.md correctly 1`] = `
<div
class="ant-result ant-result-info undefined"
class="ant-result ant-result-info"
>
<div
class="ant-result-icon"
Expand Down
5 changes: 5 additions & 0 deletions components/result/__tests__/index.test.js
Expand Up @@ -47,4 +47,9 @@ describe('Progress', () => {
const wrapper = mount(<Result status="404" />);
expect(wrapper.find('.ant-result-extra')).toHaveLength(0);
});

it('🙂 result should support className', () => {
const wrapper = mount(<Result status="404" title="404" className="my-result" />);
expect(wrapper.find('.ant-result.my-result')).toHaveLength(1);
});
});
6 changes: 3 additions & 3 deletions components/result/index.tsx
Expand Up @@ -69,17 +69,17 @@ export const OriginResult: React.SFC<ResultProps> = 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 (
<div className={`${prefixCls} ${prefixCls}-${status} ${className}`} style={style}>
<div className={className} style={style}>
{renderIcon(prefixCls, props)}
<div className={`${prefixCls}-title`}>{title}</div>
{subTitle && <div className={`${prefixCls}-subtitle`}>{subTitle}</div>}
Expand Down
10 changes: 4 additions & 6 deletions components/result/style/index.less
Expand Up @@ -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;
}

Expand Down

0 comments on commit f096b89

Please sign in to comment.