Skip to content

Commit 0ea4e94

Browse files
authored
Merge pull request #13633 from saurabhburade/shadcn/EnergyConsumptionChart
Shadcn migration - EnergyConsumptionChart
2 parents b7e4be2 + 1b0412e commit 0ea4e94

File tree

1 file changed

+11
-21
lines changed
  • src/components/EnergyConsumptionChart

1 file changed

+11
-21
lines changed

src/components/EnergyConsumptionChart/index.tsx

Lines changed: 11 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -12,19 +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 {
16-
Box,
17-
Center,
18-
Text,
19-
useBreakpointValue,
20-
useColorModeValue,
21-
} from "@chakra-ui/react"
15+
import { useBreakpointValue } from "@chakra-ui/react"
2216

2317
import type { Lang } from "@/lib/types"
2418

19+
import { Center } from "@/components/ui/flex"
20+
2521
import { wrapLabel } from "@/lib/utils/charts"
2622
import { isLangRightToLeft } from "@/lib/utils/translations"
2723

24+
import useColorModeValue from "@/hooks/useColorModeValue"
2825
import { useIsClient } from "@/hooks/useIsClient"
2926

3027
// ChartDataLabels required to display y-labels on top of bars
@@ -237,26 +234,19 @@ const EnergyConsumptionChart = () => {
237234
} satisfies ChartData
238235

239236
return (
240-
<Box my={16}>
241-
<Center w="full" mb={{ base: 4, md: 6 }}>
242-
<Box
243-
position="relative"
244-
maxW="500px"
245-
m="auto"
246-
w="80vw"
247-
h={{ base: "300px", md: "400px" }}
248-
mb={{ base: 4, md: 0 }}
249-
>
237+
<div className="my-16">
238+
<Center className="mb-4 w-full md:mb-6">
239+
<div className="relative m-auto mb-4 h-[300px] w-[80vw] max-w-[500px] md:mb-0 md:h-[400px]">
250240
{isClient && (
251241
<Bar options={chartOptions} data={chartData} updateMode="none" />
252242
)}
253-
</Box>
243+
</div>
254244
</Center>
255245

256-
<Text fontWeight="semibold" textAlign="center">
246+
<p className="text-center font-semibold">
257247
{t("page-what-is-ethereum-energy-consumption-chart-legend")}
258-
</Text>
259-
</Box>
248+
</p>
249+
</div>
260250
)
261251
}
262252

0 commit comments

Comments
 (0)