Skip to content

Commit 7534108

Browse files
committed
path color mode sync by manually updating chakras context in order to keep using useColorModeValue from chakra
1 parent 4990bf4 commit 7534108

File tree

2 files changed

+4
-3
lines changed

2 files changed

+4
-3
lines changed

src/components/ActionCard.tsx

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,14 +8,13 @@ import {
88
LinkBox,
99
type LinkBoxProps,
1010
LinkOverlay,
11+
useColorModeValue,
1112
} from "@chakra-ui/react"
1213

1314
import { Image } from "@/components/Image"
1415
import { BaseLink } from "@/components/Link"
1516
import Text from "@/components/OldText"
1617

17-
import useColorModeValue from "@/hooks/useColorModeValue"
18-
1918
const linkBoxFocusStyles: BoxProps = {
2019
borderRadius: "base",
2120
boxShadow: "0px 8px 17px rgba(0, 0, 0, 0.15)",

src/components/Nav/useNav.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ import {
1919
BsUiChecksGrid,
2020
} from "react-icons/bs"
2121
import { PiFlask, PiUsersFourLight } from "react-icons/pi"
22-
import { useDisclosure } from "@chakra-ui/react"
22+
import { useColorMode, useDisclosure } from "@chakra-ui/react"
2323

2424
import { EthereumIcon } from "@/components/icons/EthereumIcon"
2525

@@ -36,6 +36,7 @@ export const useNav = () => {
3636
const { isOpen, onToggle } = useDisclosure()
3737
const { t } = useTranslation("common")
3838
const { theme, setTheme } = useTheme()
39+
const { setColorMode } = useColorMode()
3940

4041
const colorToggleEvent = useColorModeValue("dark mode", "light mode") // This will be inverted as the state is changing
4142

@@ -477,6 +478,7 @@ export const useNav = () => {
477478

478479
const toggleColorMode = () => {
479480
setTheme(theme === "dark" ? "light" : "dark")
481+
setColorMode(theme === "dark" ? "light" : "dark")
480482
trackCustomEvent({
481483
eventCategory: "nav bar",
482484
eventAction: "click",

0 commit comments

Comments
 (0)