Convert px
metric to rem
, using an optional baseline as argument.
pixel: number
: value to be convertedbase?: number
: optional baseline, normally 16
rem: string
: The result between the pixel and base calculation
import { pxToRem } from '@platformbuilders/helpers';
pxToRem(20); // return '1.25rem'
pxToRem(20, 20); // return '1rem'