test: offset solution

ref: https://github.com/ant-design/ant-design/pull/38828
This commit is contained in:
wuxh 2022-11-22 01:31:29 +08:00
parent 6b2ec60e42
commit aacf9c3378
No known key found for this signature in database
GPG Key ID: 464F03149513C20C

View File

@ -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 {