Skip to content

Commit

Permalink
fix(badge): fix the style issue in RTL mode (#38829)
Browse files Browse the repository at this point in the history
* chore: update style

* docs(badge): add debug demo

* test: update snapshot

* test: offset solution

ref: #38828

* chore: update style

* Revert "test: offset solution"

This reverts commit aacf9c3.

* Revert "docs(badge): add debug demo"

This reverts commit 52b0dab.

* test: update snapshot
  • Loading branch information
Wxh16144 committed Nov 22, 2022
1 parent 7739d74 commit e93f660
Showing 1 changed file with 18 additions and 2 deletions.
20 changes: 18 additions & 2 deletions components/badge/style/index.tsx
Expand Up @@ -276,6 +276,15 @@ const genSharedBadgeStyle: GenerateStyle<BadgeToken> = (token: BadgeToken): CSSO
},
[`${numberPrefixCls}-symbol`]: { verticalAlign: 'top' },
},

// ====================== RTL =======================
'&-rtl': {
direction: 'rtl',

[`${componentCls}-count, ${componentCls}-dot, ${numberPrefixCls}-custom-component`]: {
insetInlineEnd: 'auto',
},
},
},
[`${ribbonWrapperPrefixCls}`]: { position: 'relative' },
[`${ribbonPrefixCls}`]: {
Expand Down Expand Up @@ -307,17 +316,24 @@ const genSharedBadgeStyle: GenerateStyle<BadgeToken> = (token: BadgeToken): CSSO
borderEndEndRadius: 0,
[`${ribbonPrefixCls}-corner`]: {
insetInlineEnd: 0,
borderColor: 'currentcolor transparent transparent currentcolor',
borderInlineEndColor: 'transparent',
borderBlockEndColor: 'transparent',
},
},
[`&${ribbonPrefixCls}-placement-start`]: {
insetInlineStart: -badgeRibbonOffset,
borderEndStartRadius: 0,
[`${ribbonPrefixCls}-corner`]: {
insetInlineStart: 0,
borderColor: 'currentcolor currentcolor transparent transparent',
borderBlockEndColor: 'transparent',
borderInlineStartColor: 'transparent',
},
},

// ====================== RTL =======================
'&-rtl': {
direction: 'rtl',
},
},
};
};
Expand Down

0 comments on commit e93f660

Please sign in to comment.