Skip to content

Commit 7713de6

Browse files
committed
feat: add theme overrides option
1 parent ad1fd83 commit 7713de6

File tree

1 file changed

+31
-3
lines changed

1 file changed

+31
-3
lines changed

libs/web/core/data-access/src/lib/app-config-provider.tsx

Lines changed: 31 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ import {
1717
import { useQuery } from '@tanstack/react-query'
1818
import { createContext, ReactNode, useContext, useMemo } from 'react'
1919
import { useSdk } from './sdk-provider'
20+
import { Input, MantineThemeOverride, Paper, Select } from '@mantine/core'
2021

2122
export interface AppConfigContext {
2223
appLogoUrlDark?: string | undefined
@@ -35,6 +36,33 @@ export interface AppConfigContext {
3536

3637
const Context = createContext<AppConfigContext>({} as AppConfigContext)
3738

39+
const themeOverrides: MantineThemeOverride = {
40+
components: {
41+
Paper: Paper.extend({
42+
styles: {
43+
root: {
44+
backgroundColor: 'transparent',
45+
},
46+
},
47+
}),
48+
49+
Input: Input.extend({
50+
styles: {
51+
input: {
52+
backgroundColor: 'transparent',
53+
},
54+
},
55+
}),
56+
Select: Select.extend({
57+
styles: {
58+
input: {
59+
backgroundColor: 'transparent',
60+
},
61+
},
62+
}),
63+
},
64+
}
65+
3866
export function AppConfigProvider({ children }: { children: ReactNode }) {
3967
const sdk = useSdk()
4068
const configQuery = useQuery({
@@ -60,10 +88,10 @@ export function AppConfigProvider({ children }: { children: ReactNode }) {
6088
const color =
6189
appConfig?.appThemeColor && mantineColorIds.includes(appConfig.appThemeColor) ? appConfig.appThemeColor : 'blue'
6290
const background: BackgroundColors = appConfig?.appThemeBackground as BackgroundColors
63-
const override =
91+
const override: MantineThemeOverride =
6492
background?.length && backgroundColorIds.includes(background)
65-
? { colors: { dark: BACKGROUND_COLORS[background] } }
66-
: {}
93+
? { ...themeOverrides, colors: { dark: BACKGROUND_COLORS[background] } }
94+
: themeOverrides
6795
return themeWithBrand(color, override)
6896
}, [appConfig])
6997

0 commit comments

Comments
 (0)