fix(Tree): Checkbox and title do not align (#41920)

This commit is contained in:
JiaQi 2023-04-21 14:59:32 +08:00 committed by GitHub
parent cdb5968558
commit 40fb753349
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -63,9 +63,16 @@ type TreeToken = DerivativeToken & {
};
export const genBaseStyle = (prefixCls: string, token: TreeToken): CSSObject => {
const { treeCls, treeNodeCls, treeNodePadding, treeTitleHeight } = token;
const treeCheckBoxMarginVertical = (treeTitleHeight - token.fontSizeLG) / 2;
const {
treeCls,
treeNodeCls,
controlInteractiveSize: checkboxSize,
treeNodePadding,
treeTitleHeight,
} = token;
// Ref: https://github.com/ant-design/ant-design/issues/41564
const checkBoxOffset = (token.lineHeight * token.fontSize) / 2 - checkboxSize / 2;
const treeCheckBoxMarginVertical = (treeTitleHeight - token.fontSizeLG) / 2 - checkBoxOffset;
const treeCheckBoxMarginHorizontal = token.paddingXS;
return {