Skip to content

Commit 7354f37

Browse files
committed
add custom useColorModeValue using next-themes context and replace all the instances
1 parent 547dffb commit 7354f37

29 files changed

+77
-34
lines changed

src/components/ActionCard.tsx

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,14 +7,15 @@ import {
77
Heading,
88
LinkBox,
99
type LinkBoxProps,
10-
LinkOverlay,
11-
useColorModeValue,
10+
LinkOverlay
1211
} from "@chakra-ui/react"
1312

1413
import { Image } from "@/components/Image"
1514
import { BaseLink } from "@/components/Link"
1615
import Text from "@/components/OldText"
1716

17+
import useColorModeValue from "@/hooks/useColorModeValue"
18+
1819
const linkBoxFocusStyles: BoxProps = {
1920
borderRadius: "base",
2021
boxShadow: "0px 8px 17px rgba(0, 0, 0, 0.15)",

src/components/AdoptionChart.tsx

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import { useTranslation } from "next-i18next"
2-
import { Box, type BoxProps, Flex, useColorMode } from "@chakra-ui/react"
2+
import { useTheme } from "next-themes"
3+
import { Box, type BoxProps, Flex } from "@chakra-ui/react"
34

45
import type { ChildOnlyProp } from "@/lib/types"
56

@@ -48,8 +49,8 @@ const ColumnName = ({ children }: ChildOnlyProp) => (
4849

4950
const AdoptionChart = () => {
5051
const { t } = useTranslation("page-what-is-ethereum")
51-
const { colorMode } = useColorMode()
52-
const isDark = colorMode === "dark"
52+
const { theme } = useTheme()
53+
const isDark = theme === "dark"
5354

5455
return (
5556
<Flex>

src/components/CardList.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,13 +8,13 @@ import {
88
LinkBox,
99
LinkOverlay,
1010
type StackProps,
11-
useColorModeValue,
1211
} from "@chakra-ui/react"
1312

1413
import { BaseLink } from "@/components/Link"
1514

1615
import * as url from "@/lib/utils/url"
1716

17+
import useColorModeValue from "@/hooks/useColorModeValue"
1818
import { useRtlFlip } from "@/hooks/useRtlFlip"
1919

2020
export type CardListItem = {

src/components/CodeModal.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,10 @@ import {
66
ModalContent,
77
ModalHeader,
88
ModalOverlay,
9-
useColorModeValue,
109
} from "@chakra-ui/react"
1110

11+
import useColorModeValue from "@/hooks/useColorModeValue"
12+
1213
type CodeModalProps = {
1314
title: string
1415
children: ReactNode

src/components/Codeblock.tsx

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,15 @@ import Highlight, {
66
PrismTheme,
77
} from "prism-react-renderer"
88
import Prism from "prism-react-renderer/prism"
9-
import { Box, BoxProps, Flex, useColorModeValue } from "@chakra-ui/react"
9+
import { Box, BoxProps, Flex } from "@chakra-ui/react"
1010

1111
import CopyToClipboard from "@/components/CopyToClipboard"
1212
import Emoji from "@/components/Emoji"
1313
// https://github.com/FormidableLabs/prism-react-renderer/tree/master#custom-language-support
14-
;(typeof global !== "undefined" ? global : window).Prism = Prism
14+
;
15+
16+
import useColorModeValue from "@/hooks/useColorModeValue"
17+
(typeof global !== "undefined" ? global : window).Prism = Prism
1518
require("prismjs/components/prism-solidity")
1619

1720
const LINES_BEFORE_COLLAPSABLE = 8

src/components/DataProductCard.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,14 @@ import {
66
Heading,
77
LinkBox,
88
LinkOverlay,
9-
useColorModeValue,
109
} from "@chakra-ui/react"
1110

1211
import { Image } from "@/components/Image"
1312

1413
import Text from "./OldText"
1514

15+
import useColorModeValue from "@/hooks/useColorModeValue"
16+
1617
export interface DataRow {
1718
logo: StaticImageData
1819
coin: string

src/components/EnergyConsumptionChart/index.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,14 +17,14 @@ import {
1717
Center,
1818
Text,
1919
useBreakpointValue,
20-
useColorModeValue,
2120
} from "@chakra-ui/react"
2221

2322
import type { Lang } from "@/lib/types"
2423

2524
import { wrapLabel } from "@/lib/utils/charts"
2625
import { isLangRightToLeft } from "@/lib/utils/translations"
2726

27+
import useColorModeValue from "@/hooks/useColorModeValue"
2828
import { useIsClient } from "@/hooks/useIsClient"
2929

3030
// ChartDataLabels required to display y-labels on top of bars

src/components/EthVideo.tsx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
1-
import { Box, useColorModeValue } from "@chakra-ui/react"
1+
import { Box } from "@chakra-ui/react"
2+
3+
import useColorModeValue from "@/hooks/useColorModeValue"
24

35
const EthVideo = () => {
46
const src = useColorModeValue(

src/components/Leaderboard.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@ import {
77
LinkOverlay,
88
List,
99
ListItem,
10-
useColorModeValue,
1110
VisuallyHidden,
1211
} from "@chakra-ui/react"
1312

@@ -16,6 +15,7 @@ import { BaseLink } from "@/components/Link"
1615

1716
import { GITHUB_URL } from "@/lib/constants"
1817

18+
import useColorModeValue from "@/hooks/useColorModeValue"
1919
import { useRtlFlip } from "@/hooks/useRtlFlip"
2020

2121
type Person = {

src/components/Logo.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
import { useTranslation } from "next-i18next"
2-
import { useColorModeValue } from "@chakra-ui/react"
32

43
import { Image } from "@/components/Image"
54

5+
import useColorModeValue from "@/hooks/useColorModeValue"
66
import darkImage from "@/public/images/ef-logo.png"
77
import lightImage from "@/public/images/ef-logo-white.png"
88

0 commit comments

Comments
 (0)