Added bars transition
This commit is contained in:
1 parent
931d15c451
commit
8778fa888f
2 files changed
+11
-4
No files matched your search
@@ -1,10 +1,16 @@
|
|||||||
import { useTheme } from "@emotion/react";
|
import { useTheme } from "@emotion/react";
|
||||||
import { Box, Stack, Tooltip, Typography } from "@mui/material";
|
import { Box, Stack, Tooltip, Typography } from "@mui/material";
|
||||||
import { formatDate } from "../../../Utils/timeUtils";
|
import { formatDate } from "../../../Utils/timeUtils";
|
||||||
|
import { useEffect, useState } from "react";
|
||||||
import "./index.css";
|
import "./index.css";
|
||||||
|
|
||||||
const BarChart = ({ checks = [] }) => {
|
const BarChart = ({ checks = [] }) => {
|
||||||
const theme = useTheme();
|
const theme = useTheme();
|
||||||
|
const [animate, setAnimate] = useState(false);
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
setAnimate(true);
|
||||||
|
});
|
||||||
|
|
||||||
// set responseTime to average if there's only one check
|
// set responseTime to average if there's only one check
|
||||||
if (checks.length === 1) {
|
if (checks.length === 1) {
|
||||||
@@ -106,15 +112,15 @@ const BarChart = ({ checks = [] }) => {
|
|||||||
sx={{
|
sx={{
|
||||||
borderRadius: "3px",
|
borderRadius: "3px",
|
||||||
"&:hover > .MuiBox-root": {
|
"&:hover > .MuiBox-root": {
|
||||||
filter: "brightness(0.8)",
|
filter: "brightness(0.8)",
|
||||||
},
|
},
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
<Box
|
<Box
|
||||||
position="absolute"
|
position="absolute"
|
||||||
bottom={0}
|
bottom={0}
|
||||||
width="100%"
|
width="100%"
|
||||||
height={`${check.responseTime}%`}
|
height={`${animate ? check.responseTime : 0}%`}
|
||||||
backgroundColor={
|
backgroundColor={
|
||||||
check.status
|
check.status
|
||||||
? theme.label.up.dotColor
|
? theme.label.up.dotColor
|
||||||
@@ -122,6 +128,7 @@ const BarChart = ({ checks = [] }) => {
|
|||||||
}
|
}
|
||||||
sx={{
|
sx={{
|
||||||
borderRadius: "3px",
|
borderRadius: "3px",
|
||||||
|
transition: "height 600ms cubic-bezier(0.4, 0, 0.2, 1)",
|
||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
</Box>
|
</Box>
|
||||||
|
|||||||
@@ -427,7 +427,7 @@ function Sidebar() {
|
|||||||
onClick={() =>
|
onClick={() =>
|
||||||
item.path === "support"
|
item.path === "support"
|
||||||
? window.open(
|
? window.open(
|
||||||
"https://github.com/bluewave-labs/bluewave-uptime",
|
"https://github.com/bluewave-labs/bluewave-uptime/issues",
|
||||||
"_blank",
|
"_blank",
|
||||||
"noreferrer"
|
"noreferrer"
|
||||||
)
|
)
|
||||||
|
|||||||
Reference in new issue
Block a user