Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: fix classname is undefined #17389

Merged
merged 5 commits into from Jul 2, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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