mirror of
https://github.com/DustinBrett/daedalOS.git
synced 2025-12-06 12:20:20 +01:00
33 lines
926 B
TypeScript
33 lines
926 B
TypeScript
import { StyleSheetManager, ThemeProvider } from "styled-components";
|
|
import { memo } from "react";
|
|
import { type FeatureBundle, LazyMotion } from "motion/react";
|
|
import { useSession } from "contexts/session";
|
|
import GlobalStyle from "styles/GlobalStyle";
|
|
import themes from "styles/themes";
|
|
import { DEFAULT_THEME } from "utils/constants";
|
|
|
|
const motionFeatures = async (): Promise<FeatureBundle> =>
|
|
(
|
|
await import(
|
|
/* webpackMode: "eager" */
|
|
"styles/motionFeatures"
|
|
)
|
|
).default;
|
|
|
|
const StyledApp: FC = ({ children }) => {
|
|
const { themeName } = useSession();
|
|
|
|
return (
|
|
<StyleSheetManager enableVendorPrefixes>
|
|
<ThemeProvider theme={themes[themeName] || themes[DEFAULT_THEME]}>
|
|
<GlobalStyle />
|
|
<LazyMotion features={motionFeatures} strict>
|
|
{children}
|
|
</LazyMotion>
|
|
</ThemeProvider>
|
|
</StyleSheetManager>
|
|
);
|
|
};
|
|
|
|
export default memo(StyledApp);
|