Skip to content

Commit

Permalink
test: offset solution
Browse files Browse the repository at this point in the history
  • Loading branch information
Wxh16144 committed Nov 21, 2022
1 parent 6b2ec60 commit aacf9c3
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions components/badge/index.tsx
Expand Up @@ -111,10 +111,13 @@ const Badge: CompoundedComponent = ({
}

const offsetStyle: React.CSSProperties = { marginTop: offset[1] };
const offsetX = parseInt(offset[0] as string, 10);

if (direction === 'rtl') {
offsetStyle.left = parseInt(offset[0] as string, 10);
offsetStyle.left = -offsetX;
offsetStyle.transform = 'translate(-50%, -50%)';
} else {
offsetStyle.right = -parseInt(offset[0] as string, 10);
offsetStyle.right = -offsetX;
}

return {
Expand Down

0 comments on commit aacf9c3

Please sign in to comment.