1 import type { ReactNode } from 'react';
2 import { useLayoutEffect } from 'react';
4 import type { ThemeTypes } from '@proton/shared/lib/themes/themes';
6 import { useTheme } from '../themes/ThemeProvider';
9 * Meant to wrap portions of ui that we know are for certain only
10 * rendered if a user visits the app(s) while unauthenticated.
12 const UnAuthenticated = ({ children, theme: maybeTheme }: { children: ReactNode; theme?: ThemeTypes }) => {
13 const theme = useTheme();
15 useLayoutEffect(() => {
16 theme.setThemeSetting();
17 if (maybeTheme !== undefined) {
18 theme.setTheme(maybeTheme);
22 return <>{children}</>;
25 export default UnAuthenticated;