From 3439d27ca8866ad4f35b6c55fabc64eaf599d9ac Mon Sep 17 00:00:00 2001 From: Artem Date: Wed, 11 May 2022 12:08:56 +0100 Subject: [PATCH] Refactor main screen metrics, fix iPad charts overlay (#177) * Refactor main screen metrics, fix iPad charts overlay * Improve metrics styles for tablets --- package.json | 3 +- src/components/metrics/index.tsx | 131 +++++++++++++++---------------- 2 files changed, 64 insertions(+), 70 deletions(-) diff --git a/package.json b/package.json index e6a709e..0e27586 100644 --- a/package.json +++ b/package.json @@ -74,6 +74,7 @@ "web-vitals": "^1.0.1" }, "resolutions": { - "@types/react": "17.0.30" + "@types/react": "17.0.30", + "react-error-overlay": "6.0.9" } } diff --git a/src/components/metrics/index.tsx b/src/components/metrics/index.tsx index b4f1add..9dc69ad 100644 --- a/src/components/metrics/index.tsx +++ b/src/components/metrics/index.tsx @@ -70,9 +70,9 @@ export const Metrics = (params: { latency: number; latencyPerBlock: number[]; }) => { - const isLessLaptop = useMediaQuery({ maxDeviceWidth: "852px" }); - const isLessTablet = useMediaQuery({ maxDeviceWidth: breakpoints.tablet }); - const isLessMobileM = useMediaQuery({ maxDeviceWidth: "468px" }); + const isLessLaptop = useMediaQuery({ query: '(max-width: 852px)' }); + const isLessTablet = useMediaQuery({ query: `(max-width: ${breakpoints.tablet})` }); + const isLessMobileM = useMediaQuery({ query: '(max-width: 468px)' }); return ( - - {!isLessMobileM && } - - - - - {!isLessMobileM && } - - - {isLessLaptop && ( - - )} - - + + + {!isLessMobileM && } + + + + + {!isLessMobileM && } + + + {isLessLaptop && ( + + )} - - {isLessLaptop && ( - - )} - - + + + + + + );