@athosws/react-components
Version:
This is a set of useful ReactJS components developed by Athos.\n Email:ladiesman217.as@gmail.com
15 lines (12 loc) • 466 B
text/typescript
export const adaptSize = (size: number, refValue: number, unit: string) => {
return `${(refValue * size) / 5}${unit}`;
};
export const getValueWithoutUnit = (value: string) => {
return parseFloat(value.replace(/[a-z]/gi, ""));
};
export const getUnitWithoutValue = (value: string) => {
return value.replace(/[0-9]/gi, "");
};
export function convertRemToPixels(rem: number) {
return rem * parseFloat(getComputedStyle(document.documentElement).fontSize);
}