snapshot of https://github.com/jitsi/jitsi-meet.git @ fd1749dd28f4138aa80234fc7f311b19aaffa0e7 (2026-09-15)
This commit is contained in:
25
react/features/base/ui/functions.any.ts
Normal file
25
react/features/base/ui/functions.any.ts
Normal file
@@ -0,0 +1,25 @@
|
||||
// Base font size in pixels (standard is 16px = 1rem)
|
||||
const BASE_FONT_SIZE = 16;
|
||||
|
||||
/**
|
||||
* Converts rem to pixels.
|
||||
*
|
||||
* @param {string} remValue - The value in rem units (e.g. '0.875rem').
|
||||
* @returns {number}
|
||||
*/
|
||||
export function remToPixels(remValue: string): number {
|
||||
const numericValue = parseFloat(remValue.replace('rem', ''));
|
||||
|
||||
return Math.round(numericValue * BASE_FONT_SIZE);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Converts pixels to rem.
|
||||
*
|
||||
* @param {number} pixels - The value in pixels.
|
||||
* @returns {string}
|
||||
* */
|
||||
export function pixelsToRem(pixels: number): string {
|
||||
return `${(pixels / BASE_FONT_SIZE).toFixed(3)}rem`;
|
||||
}
|
||||
Reference in New Issue
Block a user