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(badge): fix badge number is rtl #43998

Merged
merged 7 commits into from
Aug 14, 2023
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
32 changes: 18 additions & 14 deletions components/avatar/__tests__/__snapshots__/demo-extend.test.ts.snap
Original file line number Diff line number Diff line change
Expand Up @@ -39,16 +39,18 @@ exports[`renders components/avatar/demo/badge.tsx extend context correctly 1`] =
data-show="true"
title="1"
>
<span
class="ant-scroll-number-only"
style="transition: none;"
>
<bdi>
<span
class="ant-scroll-number-only-unit current"
class="ant-scroll-number-only"
style="transition: none;"
>
1
<span
class="ant-scroll-number-only-unit current"
>
1
</span>
</span>
</span>
</bdi>
</sup>
</span>
</div>
Expand Down Expand Up @@ -531,16 +533,18 @@ Array [
data-show="true"
title="1"
>
<span
class="ant-scroll-number-only"
style="transition: none;"
>
<bdi>
<span
class="ant-scroll-number-only-unit current"
class="ant-scroll-number-only"
style="transition: none;"
>
1
<span
class="ant-scroll-number-only-unit current"
>
1
</span>
</span>
</span>
</bdi>
</sup>
</span>
</div>
Expand Down
32 changes: 18 additions & 14 deletions components/avatar/__tests__/__snapshots__/demo.test.tsx.snap
Original file line number Diff line number Diff line change
Expand Up @@ -39,16 +39,18 @@ exports[`renders components/avatar/demo/badge.tsx correctly 1`] = `
data-show="true"
title="1"
>
<span
class="ant-scroll-number-only"
style="transition:none"
>
<bdi>
<span
class="ant-scroll-number-only-unit current"
class="ant-scroll-number-only"
style="transition:none"
>
1
<span
class="ant-scroll-number-only-unit current"
>
1
</span>
</span>
</span>
</bdi>
</sup>
</span>
</div>
Expand Down Expand Up @@ -438,16 +440,18 @@ Array [
data-show="true"
title="1"
>
<span
class="ant-scroll-number-only"
style="transition:none"
>
<bdi>
<span
class="ant-scroll-number-only-unit current"
class="ant-scroll-number-only"
style="transition:none"
>
1
<span
class="ant-scroll-number-only-unit current"
>
1
</span>
</span>
</span>
</bdi>
</sup>
</span>
</div>
Expand Down
22 changes: 13 additions & 9 deletions components/badge/ScrollNumber.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -51,15 +51,19 @@ const ScrollNumber = React.forwardRef<HTMLElement, ScrollNumberProps>((props, re
if (count && Number(count) % 1 === 0) {
const numberList = String(count).split('');

numberNodes = numberList.map((num, i) => (
<SingleNumber
prefixCls={prefixCls}
count={Number(count)}
value={num}
// eslint-disable-next-line react/no-array-index-key
key={numberList.length - i}
/>
));
numberNodes = (
<bdi>
{numberList.map((num, i) => (
<SingleNumber
prefixCls={prefixCls}
count={Number(count)}
value={num}
// eslint-disable-next-line react/no-array-index-key
key={numberList.length - i}
/>
))}
</bdi>
);
}

// allow specify the border
Expand Down