chore: extract getSizeStyle

This commit is contained in:
chenjiahan
2020-08-26 18:09:32 +08:00
parent 47a7ccef85
commit 216417eae6
7 changed files with 29 additions and 53 deletions
+10
View File
@@ -10,6 +10,16 @@ export function addUnit(value?: string | number): string | undefined {
return isNumeric(value) ? `${value}px` : value;
}
export function getSizeStyle(originSize?: string | number) {
if (isDef(originSize)) {
const size = addUnit(originSize);
return {
width: size,
height: size,
};
}
}
// cache
let rootFontSize: number;
+1 -1
View File
@@ -1,4 +1,4 @@
export { addUnit } from './format/unit';
export { addUnit, getSizeStyle } from './format/unit';
export { createNamespace } from './create';
// eslint-disable-next-line @typescript-eslint/no-empty-function