Skip to content

Commit 0584324

Browse files
refactor(ThemeProvider): remove Chakra provider and remove useColorMode from useNav
1 parent 6e56963 commit 0584324

File tree

2 files changed

+2
-26
lines changed

2 files changed

+2
-26
lines changed

src/components/Nav/useNav.ts

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@ import {
1818
BsUiChecksGrid,
1919
} from "react-icons/bs"
2020
import { PiFlask, PiUsersFourLight } from "react-icons/pi"
21-
import { useColorMode } from "@chakra-ui/react"
2221

2322
import EthereumIcon from "@/components/icons/ethereum-icon.svg"
2423

@@ -29,8 +28,6 @@ import type { NavSections } from "./types"
2928
export const useNav = () => {
3029
const { t } = useTranslation("common")
3130
const { setTheme, resolvedTheme } = useTheme()
32-
// TODO Remove when removing chakra provider
33-
const { setColorMode } = useColorMode()
3431

3532
const linkSections: NavSections = {
3633
learn: {
@@ -476,7 +473,7 @@ export const useNav = () => {
476473
const targetTheme = resolvedTheme === "dark" ? "light" : "dark"
477474

478475
setTheme(targetTheme)
479-
setColorMode(targetTheme)
476+
// setColorMode(targetTheme)
480477

481478
trackCustomEvent({
482479
eventCategory: "nav bar",

src/components/ThemeProvider.tsx

Lines changed: 1 addition & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,45 +1,24 @@
1-
import { useMemo } from "react"
2-
import merge from "lodash/merge"
31
import { ThemeProvider as NextThemesProvider } from "next-themes"
42
import type { ThemeProviderProps } from "next-themes/dist/types"
5-
import { ChakraBaseProvider, createLocalStorageManager } from "@chakra-ui/react"
6-
7-
import customTheme from "@/@chakra-ui/theme"
83

94
import { COLOR_MODE_STORAGE_KEY } from "@/lib/constants"
105

11-
import { useLocaleDirection } from "@/hooks/useLocaleDirection"
12-
13-
const colorModeManager = createLocalStorageManager(COLOR_MODE_STORAGE_KEY)
14-
156
/**
167
* Primary theming wrapper for use with color mode. Uses the theme provider
178
* from `next-themes`.
189
*
1910
* Applied to _app.tsx as the main provider for the project, and supplied as the
2011
* primary decorator to Storybook.
21-
*
22-
* NOTE: This also includes the Chakra Provider. This will be removed after migration to ShadCN/Tailwind is complete
2312
*/
2413
const ThemeProvider = ({ children }: Pick<ThemeProviderProps, "children">) => {
25-
const direction = useLocaleDirection()
26-
27-
const theme = useMemo(() => merge(customTheme, { direction }), [direction])
2814
return (
2915
<NextThemesProvider
3016
attribute="data-theme"
3117
defaultTheme="light"
32-
enableSystem={false}
3318
disableTransitionOnChange
3419
storageKey={COLOR_MODE_STORAGE_KEY}
3520
>
36-
<ChakraBaseProvider
37-
theme={theme}
38-
colorModeManager={colorModeManager}
39-
resetCSS={false}
40-
>
41-
{children}
42-
</ChakraBaseProvider>
21+
{children}
4322
</NextThemesProvider>
4423
)
4524
}

0 commit comments

Comments
 (0)