The communications platform that puts data protection first.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
Rocket.Chat/apps/meteor/client/views/root/hooks/loggedIn/useFontStylePreference.ts

15 lines
650 B

import type { FontSize } from '@rocket.chat/rest-typings';
import { useUserPreference } from '@rocket.chat/ui-contexts';
import { useLayoutEffect } from 'react';
import { useCreateFontStyleElement } from '../../../account/accessibility/hooks/useCreateFontStyleElement';
export const useFontStylePreference = () => {
const fontSize = useUserPreference<FontSize>('fontSize');
const createFontStyleElement = useCreateFontStyleElement();
useLayoutEffect(() => {
// Handle the edge case where the font-size preference ceases to exist: set to 100% (default)
createFontStyleElement(fontSize || '100%');
}, [fontSize, createFontStyleElement]);
};