Skip to content

Commit

Permalink
Remove deprecated ThemeProvider export
Browse files Browse the repository at this point in the history
  • Loading branch information
lachlanjc committed Nov 28, 2023
1 parent 650c52b commit ec3c4e5
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 39 deletions.
27 changes: 0 additions & 27 deletions packages/theme-provider/src/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -56,30 +56,3 @@ export const ThemeUIProvider = ({ theme, children }: ThemeProviderProps) => {
</CoreProvider>
)
}

/** @deprecated ThemeProvider is now called ThemeUIProvider to reduce confusion with Emotion */
export const ThemeProvider: React.FC<ThemeProviderProps> = ({
theme,
children,
}) => {
React.useEffect(() => {
if (process.env.NODE_ENV !== 'production') {
console.warn(
'[theme-ui] The export ThemeProvider is deprecated and is now called ThemeUIProvider to reduce confusion with Emotion. Please update your import; ThemeProvider will be removed in a future version.'
)
}
}, [])

const outer = useThemeUI()

const isTopLevel = outer === __themeUiDefaultContextValue

return (
<CoreProvider theme={theme}>
<ColorModeProvider>
{isTopLevel && <RootStyles />}
{children}
</ColorModeProvider>
</CoreProvider>
)
}
12 changes: 0 additions & 12 deletions packages/theme-ui/test/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ import mockConsole from 'jest-mock-console'
import { fireEvent, render, renderJSON } from '@theme-ui/test-utils'

import {
ThemeProvider as DeprecatedThemeProvider,
ThemeUIProvider,
jsx,
BaseStyles,
Expand Down Expand Up @@ -51,17 +50,6 @@ test('warns when multiple versions of emotion are installed', () => {
restore()
})

test('warns deprecated ThemeUIProvider', () => {
const restore = mockConsole()
render(
<DeprecatedThemeProvider theme={{}}>
<div />
</DeprecatedThemeProvider>
)
expect(console.warn).toHaveBeenCalled()
restore()
})

test('functional themes receive outer theme', () => {
const outer: Theme = {
config: {
Expand Down

0 comments on commit ec3c4e5

Please sign in to comment.