Skip to content

Commit

Permalink
fix: new colors adjustments and fix form styles [NU-1646]
Browse files Browse the repository at this point in the history
  • Loading branch information
JulianWielga committed Jun 14, 2024
1 parent d8f8a13 commit a05f7d4
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 14 deletions.
15 changes: 2 additions & 13 deletions src/components/root.tsx
Original file line number Diff line number Diff line change
@@ -1,23 +1,12 @@
import { Box, CssBaseline, Theme, ThemeProvider } from "@mui/material";
import { Box, CssBaseline, ThemeProvider } from "@mui/material";
import React from "react";
import { BrowserRouter as Router } from "react-router-dom";
import { RootRoutes } from "./routes";
import { theme } from "./theme";
import { deepmerge } from "@mui/utils";

export const Root = () => {
return (
<ThemeProvider theme={(outerTheme: Theme) => {
if(!Object.keys(outerTheme).length) {
return theme
}

// Let's set aside the parent form style since we won't be using the same form style throughout the entire app.
const {components: {MuiFormControl, MuiFormHelperText, MuiFormLabel}, ...filteredOuterTheme} = outerTheme

return deepmerge(theme, filteredOuterTheme )

}}>
<ThemeProvider theme={theme}>
<CssBaseline />
<Box minHeight="100vh" display="flex" flex={1}>
<Router>
Expand Down
21 changes: 20 additions & 1 deletion src/components/rootProviders.tsx
Original file line number Diff line number Diff line change
@@ -1,17 +1,36 @@
import { Theme, ThemeProvider } from "@mui/material";
import { deepmerge } from "@mui/utils";
import { LocalizationProvider } from "@mui/x-date-pickers";
import { AdapterMoment } from "@mui/x-date-pickers/AdapterMoment";
import { configure } from "mobx";
import * as React from "react";
import { PropsWithChildren } from "react";
import { Options } from "../config";
import { StoreProvider } from "../store/storeProvider";
import { theme } from "./theme";

configure({
enforceActions: "observed",
});

export const RootProviders = ({ children }: PropsWithChildren<unknown>) => (
<StoreProvider options={Options}>
<LocalizationProvider dateAdapter={AdapterMoment}>{children}</LocalizationProvider>
<ThemeProvider
theme={(outerTheme: Theme) => {
if (!Object.keys(outerTheme).length) {
return theme;
}

// Let's set aside the parent form style since we won't be using the same form style throughout the entire app.
const {
components: { MuiFormControl, MuiFormHelperText, MuiFormLabel },
...filteredOuterTheme
} = outerTheme;

return deepmerge(theme, filteredOuterTheme);
}}
>
<LocalizationProvider dateAdapter={AdapterMoment}>{children}</LocalizationProvider>
</ThemeProvider>
</StoreProvider>
);

0 comments on commit a05f7d4

Please sign in to comment.