Jitsi Meet - Secure, Simple and Scalable Video Conferences that you use as a standalone app or embed in your web application.
TypeScript debiandeep-videojitsijitsi-meetscalable-video-conferencessfuvideovideo-communicationvideo-conferencingwebrtc
Revert typography values in tokens to px from rem (#16026)
Hristo Terezovd5793c244555
diff --git a/react/features/base/ui/Tokens.ts b/react/features/base/ui/Tokens.tsindex e3b3e6472b..d165d95a92 100644--- a/react/features/base/ui/Tokens.ts+++ b/react/features/base/ui/Tokens.ts@@ -118,8 +118,8 @@ export const colorMap = {export const font = {- weightRegular: 400,- weightSemiBold: 600+ weightRegular: '400',+ weightSemiBold: '600'};export const shape = {@@ -136,64 +136,64 @@ export const typography = {labelBold: 'labelBold01',bodyShortRegularSmall: {- fontSize: '0.625rem',- lineHeight: '1rem',+ fontSize: 10,+ lineHeight: 16,fontWeight: font.weightRegular,letterSpacing: 0},bodyShortRegular: {- fontSize: '0.875rem',- lineHeight: '1.25rem',+ fontSize: 14,+ lineHeight: 20,fontWeight: font.weightRegular,letterSpacing: 0},bodyShortBold: {- fontSize: '0.875rem',- lineHeight: '1.25rem',+ fontSize: 14,+ lineHeight: 20,fontWeight: font.weightSemiBold,letterSpacing: 0},bodyShortRegularLarge: {- fontSize: '1rem',- lineHeight: '1.375rem',+ fontSize: 16,+ lineHeight: 22,fontWeight: font.weightRegular,letterSpacing: 0},bodyShortBoldLarge: {- fontSize: '1rem',- lineHeight: '1.375rem',+ fontSize: 16,+ lineHeight: 22,fontWeight: font.weightSemiBold,letterSpacing: 0},bodyLongRegular: {- fontSize: '0.875rem',- lineHeight: '1.5rem',+ fontSize: 14,+ lineHeight: 24,fontWeight: font.weightRegular,letterSpacing: 0},bodyLongRegularLarge: {- fontSize: '1rem',- lineHeight: '1.625rem',+ fontSize: 16,+ lineHeight: 26,fontWeight: font.weightRegular,letterSpacing: 0},bodyLongBold: {- fontSize: '0.875rem',- lineHeight: '1.5rem',+ fontSize: 14,+ lineHeight: 24,fontWeight: font.weightSemiBold,letterSpacing: 0},bodyLongBoldLarge: {- fontSize: '1rem',- lineHeight: '1.625rem',+ fontSize: 16,+ lineHeight: 26,fontWeight: font.weightSemiBold,letterSpacing: 0},@@ -203,29 +203,29 @@ export const typography = {heading2: 'heading02',heading3: {- fontSize: '2rem',- lineHeight: '2.5rem',+ fontSize: 32,+ lineHeight: 40,fontWeight: font.weightSemiBold,letterSpacing: 0},heading4: {- fontSize: '1.75rem',- lineHeight: '2.25rem',+ fontSize: 28,+ lineHeight: 36,fontWeight: font.weightSemiBold,letterSpacing: 0},heading5: {- fontSize: '1.25rem',- lineHeight: '1.75rem',+ fontSize: 20,+ lineHeight: 28,fontWeight: font.weightSemiBold,letterSpacing: 0},heading6: {- fontSize: '1rem',- lineHeight: '1.625rem',+ fontSize: 16,+ lineHeight: 26,fontWeight: font.weightSemiBold,letterSpacing: 0}diff --git a/react/features/base/ui/functions.any.ts b/react/features/base/ui/functions.any.tsdeleted file mode 100644index 8bef961a1d..0000000000--- a/react/features/base/ui/functions.any.ts+++ /dev/null@@ -1,14 +0,0 @@-// 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);-}diff --git a/react/features/base/ui/functions.native.ts b/react/features/base/ui/functions.native.tsindex 64eb143f64..602f4b0a3e 100644--- a/react/features/base/ui/functions.native.ts+++ b/react/features/base/ui/functions.native.ts@@ -1,35 +1,6 @@import { DefaultTheme } from 'react-native-paper';import { createColorTokens } from './utils';-import { remToPixels } from './functions.any';--export * from './functions.any';--/**- * Converts all rem to pixels in an object.- *- * @param {Object} obj - The object to convert rem values in.- * @returns {Object}- */-function convertRemValues(obj: any): any {- const converted: { [key: string]: any; } = {};-- if (typeof obj !== 'object' || obj === null) {- return obj;- }-- Object.entries(obj).forEach(([ key, value ]) => {- if (typeof value === 'string' && value.includes('rem')) {- converted[key] = remToPixels(value);- } else if (typeof value === 'object' && value !== null) {- converted[key] = convertRemValues(value);- } else {- converted[key] = value;- }- });-- return converted;-}/*** Creates a React Native Paper theme based on local UI tokens.@@ -45,7 +16,7 @@ export function createNativeTheme({ font, colorMap, shape, spacing, typography }spacing,typography: {font,- ...convertRemValues(typography)+ ...typography}};}diff --git a/react/features/base/ui/functions.web.ts b/react/features/base/ui/functions.web.tsindex 03bee6014b..01774a7412 100644--- a/react/features/base/ui/functions.web.ts+++ b/react/features/base/ui/functions.web.ts@@ -5,8 +5,6 @@ import { ITypography, IPalette as Palette1 } from '../ui/types';import { createColorTokens } from './utils';-export * from './functions.any';-declare module '@mui/material/styles' {// eslint-disable-next-line @typescript-eslint/no-empty-interfaceinterface Palette extends Palette1 {}diff --git a/react/features/base/ui/types.ts b/react/features/base/ui/types.tsindex 04395026e7..8a3bd8857c 100644--- a/react/features/base/ui/types.ts+++ b/react/features/base/ui/types.ts@@ -1,8 +1,8 @@interface ITypographyType {- fontSize: string;+ fontSize: number;fontWeight: string;letterSpacing: number;- lineHeight: string;+ lineHeight: number;}export interface IPalette {diff --git a/react/features/display-name/components/web/StageParticipantNameLabel.tsx b/react/features/display-name/components/web/StageParticipantNameLabel.tsxindex 5fe66b098f..1eb9242890 100644--- a/react/features/display-name/components/web/StageParticipantNameLabel.tsx+++ b/react/features/display-name/components/web/StageParticipantNameLabel.tsx@@ -5,7 +5,7 @@ import { makeStyles } from 'tss-react/mui';import { IReduxState } from '../../../app/types';import { getParticipantDisplayName, isScreenShareParticipant } from '../../../base/participants/functions';import { withPixelLineHeight } from '../../../base/styles/functions.web';-import { getVideospaceFloatingElementsBottomSpacing, remToPixels } from '../../../base/ui/functions.web';+import { getVideospaceFloatingElementsBottomSpacing } from '../../../base/ui/functions.web';import { getLargeVideoParticipant } from '../../../large-video/functions';import {getTransitionParamsForElementsAboveToolbox,@@ -28,13 +28,9 @@ interface IOptions {}const useStyles = makeStyles<IOptions, 'screenSharing'>()((theme, options: IOptions = {}, classes) => {- const originalTypography = getStageParticipantTypography(theme);const typography = {- ...originalTypography,- fontSize: remToPixels(originalTypography.fontSize),- lineHeight: remToPixels(originalTypography.lineHeight)+ ...getStageParticipantTypography(theme)};-const { clientHeight } = options;if (typeof clientHeight === 'number' && clientHeight > 0) {diff --git a/react/features/display-name/components/web/styles.ts b/react/features/display-name/components/web/styles.tsindex 1da30aa634..734a4a2603 100644--- a/react/features/display-name/components/web/styles.ts+++ b/react/features/display-name/components/web/styles.ts@@ -1,5 +1,4 @@import { Theme } from '@mui/material';-import { remToPixels } from '../../../base/ui/functions.any';/*** The vertical padding for the display name.@@ -24,8 +23,8 @@ export function getStageParticipantTypography(theme: Theme) {*/export function getStageParticipantFontSizeRange(theme: Theme) {return {- max: remToPixels(theme.typography.bodyShortRegularLarge.fontSize),- min: remToPixels(theme.typography.bodyShortRegularSmall.fontSize)+ max: theme.typography.bodyShortRegularLarge.fontSize,+ min: theme.typography.bodyShortRegularSmall.fontSize};}@@ -37,8 +36,8 @@ export function getStageParticipantFontSizeRange(theme: Theme) {*/export function getStageParticipantLineHeightRange(theme: Theme) {return {- max: remToPixels(String(theme.typography.bodyShortRegularLarge.lineHeight)),- min: remToPixels(String(theme.typography.bodyShortRegularSmall.lineHeight))+ max: theme.typography.bodyShortRegularLarge.lineHeight,+ min: theme.typography.bodyShortRegularSmall.lineHeight};}