Skip to content

Commit

Permalink
Fix emotion and css-modules specificity (#6632)
Browse files Browse the repository at this point in the history
  • Loading branch information
dylanjeffers authored Nov 9, 2023
1 parent 35f87fa commit 99bad78
Showing 1 changed file with 15 additions and 4 deletions.
19 changes: 15 additions & 4 deletions packages/harmony/src/foundations/theme/ThemeProvider.tsx
Original file line number Diff line number Diff line change
@@ -1,10 +1,19 @@
import type { ReactNode } from 'react'

import { ThemeProvider as EmotionThemeProvider } from '@emotion/react'
import createCache from '@emotion/cache'
import {
CacheProvider,
ThemeProvider as EmotionThemeProvider
} from '@emotion/react'

import { themes } from './theme'
import type { Theme } from './types'

const harmonyCache = createCache({
key: 'harmony',
prepend: true
})

type ThemeProviderProps = {
theme: Theme
children: ReactNode
Expand All @@ -14,8 +23,10 @@ export const ThemeProvider = (props: ThemeProviderProps) => {
const { children, theme } = props

return (
<EmotionThemeProvider theme={themes[theme]}>
{children}
</EmotionThemeProvider>
<CacheProvider value={harmonyCache}>
<EmotionThemeProvider theme={themes[theme]}>
{children}
</EmotionThemeProvider>
</CacheProvider>
)
}

0 comments on commit 99bad78

Please sign in to comment.