bigbluebutton-Github/bigbluebutton-html5/imports/ui/components/custom-styles/component.tsx
João Victor Nunes 9f18221fc9
fix: Custom styles not applying to loading screen (#21263)
* fix: Custom styles not applying to loading screen

* fix: Apply custom styles before rendering children

* fix: Use Object.assign instead of spread syntax

* fix: Add cleanup function to clear the timeout and abort the fetch

* fix: Clear the timeout if the fetch completes successfully

* refactor: Remove unused queries file
2024-09-27 10:28:26 -04:00

27 lines
875 B
TypeScript

import React from 'react';
import useUserSettings from '/imports/ui/core/local-states/useUserSettings';
interface CustomStylesProps {
children: React.ReactNode;
}
const CustomStyles: React.FC<CustomStylesProps> = (props) => {
const { children } = props;
const [userSettings] = useUserSettings();
const customStyleUrl = userSettings.bbb_custom_style_url
|| window.meetingClientSettings.public.app.customStyleUrl;
const customStyle = userSettings.bbb_custom_style;
return (
<>
{customStyleUrl && typeof customStyleUrl === 'string' ? <link rel="stylesheet" type="text/css" href={customStyleUrl} /> : null}
{customStyle && typeof customStyle === 'string' ? <link rel="stylesheet" type="text/css" href={`data:text/css;charset=UTF-8,${encodeURIComponent(customStyle)}`} /> : null}
{children}
</>
);
};
export default CustomStyles;