Skip to content

Commit 1b0412e

Browse files
committed
chore: reuse useColorModeValue hook & Center component
1 parent 18998d1 commit 1b0412e

File tree

1 file changed

+6
-3
lines changed
  • src/components/EnergyConsumptionChart

1 file changed

+6
-3
lines changed

src/components/EnergyConsumptionChart/index.tsx

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,13 +12,16 @@ import ChartDataLabels from "chartjs-plugin-datalabels"
1212
import { useRouter } from "next/router"
1313
import { useTranslation } from "next-i18next"
1414
import { Bar } from "react-chartjs-2"
15-
import { useBreakpointValue, useColorModeValue } from "@chakra-ui/react"
15+
import { useBreakpointValue } from "@chakra-ui/react"
1616

1717
import type { Lang } from "@/lib/types"
1818

19+
import { Center } from "@/components/ui/flex"
20+
1921
import { wrapLabel } from "@/lib/utils/charts"
2022
import { isLangRightToLeft } from "@/lib/utils/translations"
2123

24+
import useColorModeValue from "@/hooks/useColorModeValue"
2225
import { useIsClient } from "@/hooks/useIsClient"
2326

2427
// ChartDataLabels required to display y-labels on top of bars
@@ -232,13 +235,13 @@ const EnergyConsumptionChart = () => {
232235

233236
return (
234237
<div className="my-16">
235-
<div className="mb-4 flex w-full items-center justify-center md:mb-6">
238+
<Center className="mb-4 w-full md:mb-6">
236239
<div className="relative m-auto mb-4 h-[300px] w-[80vw] max-w-[500px] md:mb-0 md:h-[400px]">
237240
{isClient && (
238241
<Bar options={chartOptions} data={chartData} updateMode="none" />
239242
)}
240243
</div>
241-
</div>
244+
</Center>
242245

243246
<p className="text-center font-semibold">
244247
{t("page-what-is-ethereum-energy-consumption-chart-legend")}

0 commit comments

Comments
 (0)