Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Shadcn migration - EnergyConsumptionChart #13633

Merged
merged 3 commits into from
Aug 16, 2024
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 9 additions & 22 deletions src/components/EnergyConsumptionChart/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,7 @@ import ChartDataLabels from "chartjs-plugin-datalabels"
import { useRouter } from "next/router"
import { useTranslation } from "next-i18next"
import { Bar } from "react-chartjs-2"
import {
Box,
Center,
Text,
useBreakpointValue,
useColorModeValue,
} from "@chakra-ui/react"
import { useBreakpointValue, useColorModeValue } from "@chakra-ui/react"
saurabhburade marked this conversation as resolved.
Show resolved Hide resolved
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok about useBreakpointValue. We need to think how we could replace it but not a blocker for this PR though.

cc @TylerAPfledderer maybe something we could do with tv responsive variants? do you have something in mind?


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

Expand Down Expand Up @@ -237,26 +231,19 @@ const EnergyConsumptionChart = () => {
} satisfies ChartData

return (
<Box my={16}>
<Center w="full" mb={{ base: 4, md: 6 }}>
<Box
position="relative"
maxW="500px"
m="auto"
w="80vw"
h={{ base: "300px", md: "400px" }}
mb={{ base: 4, md: 0 }}
>
<div className="my-16">
<div className="mb-4 flex w-full items-center justify-center md:mb-6">
saurabhburade marked this conversation as resolved.
Show resolved Hide resolved
<div className="relative m-auto mb-4 h-[300px] w-[80vw] max-w-[500px] md:mb-0 md:h-[400px]">
{isClient && (
<Bar options={chartOptions} data={chartData} updateMode="none" />
)}
</Box>
</Center>
</div>
</div>

<Text fontWeight="semibold" textAlign="center">
<p className="text-center font-semibold">
{t("page-what-is-ethereum-energy-consumption-chart-legend")}
</Text>
</Box>
</p>
</div>
)
}

Expand Down
Loading