Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove deprecated ThemeProvider export #2461

Draft
wants to merge 1 commit into
base: develop
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading