Skip to content

Commit

Permalink
deep merge opts and default opts
Browse files Browse the repository at this point in the history
  • Loading branch information
ChristopherChudzicki committed Jan 17, 2025
1 parent a548cdd commit 2737ac3
Show file tree
Hide file tree
Showing 3 changed files with 50 additions and 8 deletions.
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@
"@emotion/styled": "^11.11.0",
"@mui/material": "^6.1.6",
"@mui/system": "^6.1.6",
"@mui/utils": "^6.4.0",
"@remixicon/react": "^4.2.0",
"@types/jest": "^29.5.14",
"ai": "^4.0.13",
Expand Down
10 changes: 2 additions & 8 deletions src/components/ThemeProvider/ThemeProvider.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import {
ThemeProvider as MuiThemeProvider,
} from "@mui/material/styles"
import type { ThemeOptions, Theme } from "@mui/material/styles"
import { deepmerge } from "@mui/utils"
import * as typography from "./typography"
import * as buttons from "./buttons"
import * as chips from "./chips"
Expand Down Expand Up @@ -75,14 +76,7 @@ const defaultThemeOptions: ThemeOptions = {
* for more.
*/
const createTheme = (options: ThemeOptions = {}): Theme =>
muiCreateTheme({
...defaultThemeOptions,
...options,
custom: {
...defaultThemeOptions.custom,
...options?.custom,
},
})
muiCreateTheme(deepmerge(defaultThemeOptions, options))

const defaultTheme = createTheme()

Expand Down
47 changes: 47 additions & 0 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -2487,6 +2487,7 @@ __metadata:
"@jest/environment": "npm:^29.7.0"
"@mui/material": "npm:^6.1.6"
"@mui/system": "npm:^6.1.6"
"@mui/utils": "npm:^6.4.0"
"@remixicon/react": "npm:^4.2.0"
"@storybook/addon-actions": "npm:^8.4.7"
"@storybook/addon-essentials": "npm:^8.4.7"
Expand Down Expand Up @@ -2674,6 +2675,18 @@ __metadata:
languageName: node
linkType: hard

"@mui/types@npm:^7.2.21":
version: 7.2.21
resolution: "@mui/types@npm:7.2.21"
peerDependencies:
"@types/react": ^17.0.0 || ^18.0.0 || ^19.0.0
peerDependenciesMeta:
"@types/react":
optional: true
checksum: 10/cf604b02ee8a9127fe1cdcd1d2ee5d5aa92b2a3543b465a09c46a8be2452df7c58930ac0d8e55610e7130efe0fb9de9fa0c8522e30a04ca5dadc6640a4c77eda
languageName: node
linkType: hard

"@mui/utils@npm:^6.1.6":
version: 6.1.6
resolution: "@mui/utils@npm:6.1.6"
Expand All @@ -2694,6 +2707,26 @@ __metadata:
languageName: node
linkType: hard

"@mui/utils@npm:^6.4.0":
version: 6.4.0
resolution: "@mui/utils@npm:6.4.0"
dependencies:
"@babel/runtime": "npm:^7.26.0"
"@mui/types": "npm:^7.2.21"
"@types/prop-types": "npm:^15.7.14"
clsx: "npm:^2.1.1"
prop-types: "npm:^15.8.1"
react-is: "npm:^19.0.0"
peerDependencies:
"@types/react": ^17.0.0 || ^18.0.0 || ^19.0.0
react: ^17.0.0 || ^18.0.0 || ^19.0.0
peerDependenciesMeta:
"@types/react":
optional: true
checksum: 10/fb1e3d0a6e44fe9cd3aae68456084966f4d0f73f7be4cfe4e4998a9cf11f199aced8aedae7192f7da1c7c7814551aa13202e58c8c6531deae43b866a980744ec
languageName: node
linkType: hard

"@next/env@npm:15.1.3":
version: 15.1.3
resolution: "@next/env@npm:15.1.3"
Expand Down Expand Up @@ -4721,6 +4754,13 @@ __metadata:
languageName: node
linkType: hard

"@types/prop-types@npm:^15.7.14":
version: 15.7.14
resolution: "@types/prop-types@npm:15.7.14"
checksum: 10/d0c5407b9ccc3dd5fae0ccf9b1007e7622ba5e6f1c18399b4f24dff33619d469da4b9fa918a374f19dc0d9fe6a013362aab0b844b606cfc10676efba3f5f736d
languageName: node
linkType: hard

"@types/react-dom@npm:^19.0.0":
version: 19.0.2
resolution: "@types/react-dom@npm:19.0.2"
Expand Down Expand Up @@ -14218,6 +14258,13 @@ __metadata:
languageName: node
linkType: hard

"react-is@npm:^19.0.0":
version: 19.0.0
resolution: "react-is@npm:19.0.0"
checksum: 10/6cd3695c462ec3f0d4db98583f0c1b9a439248d60214f6c42c2b0e2951a1066339d0eefa74707f03484042e043fca87750282a35b652492c035f5f3da0d6498a
languageName: node
linkType: hard

"react-markdown@npm:^9.0.1":
version: 9.0.1
resolution: "react-markdown@npm:9.0.1"
Expand Down

0 comments on commit 2737ac3

Please sign in to comment.