From 8d3518f0bfb68fbe2705c90c5abfb13f7566cd6c Mon Sep 17 00:00:00 2001 From: Ken Hibino Date: Sat, 4 Dec 2021 07:10:18 -0800 Subject: [PATCH] (ui): Add shift buttons to MetricsFetchControls --- ui/src/components/MetricsFetchControls.tsx | 74 ++++++++++++++++++++++ 1 file changed, 74 insertions(+) diff --git a/ui/src/components/MetricsFetchControls.tsx b/ui/src/components/MetricsFetchControls.tsx index d2fcf42..f59da5e 100644 --- a/ui/src/components/MetricsFetchControls.tsx +++ b/ui/src/components/MetricsFetchControls.tsx @@ -10,6 +10,8 @@ import FormControl from "@material-ui/core/FormControl"; import FormLabel from "@material-ui/core/FormLabel"; import TextField from "@material-ui/core/TextField"; import Typography from "@material-ui/core/Typography"; +import ArrowLeftIcon from "@material-ui/icons/ArrowLeft"; +import ArrowRightIcon from "@material-ui/icons/ArrowRight"; import dayjs from "dayjs"; import { currentUnixtime, parseDuration } from "../utils"; import { AppState } from "../store"; @@ -51,6 +53,25 @@ const useStyles = makeStyles((theme) => ({ endTimeCaption: { marginRight: theme.spacing(1), }, + endTimeShiftControls: { + padding: theme.spacing(1), + display: "flex", + alignItems: "center", + justifyContent: "center", + borderBottomColor: theme.palette.divider, + borderBottomWidth: 1, + borderBottomStyle: "solid", + }, + leftShiftButtons: { + display: "flex", + alignItems: "center", + marginRight: theme.spacing(2), + }, + rightShiftButtons: { + display: "flex", + alignItems: "center", + marginLeft: theme.spacing(2), + }, controlsContainer: { display: "flex", justifyContent: "flex-end", @@ -312,6 +333,20 @@ function MetricsFetchControls(props: Props) { horizontal: "center", }} > +
+
+ {}} /> + {}} /> + {}} /> + {}} /> +
+
+ {}} /> + {}} /> + {}} /> + {}} /> +
+
void; + direction: "left" | "right"; +} + +const useShiftButtonStyles = makeStyles((theme) => ({ + root: { minWidth: 40, fontWeight: 400 }, + label: { fontSize: 12, textTransform: "none" }, + iconRoot: { + marginRight: (props: ShiftButtonProps) => + props.direction === "left" ? -8 : 0, + marginLeft: (props: ShiftButtonProps) => + props.direction === "right" ? -8 : 0, + color: theme.palette.grey[700], + }, +})); + +function ShiftButton(props: ShiftButtonProps) { + const classes = useShiftButtonStyles(props); + return ( + + ); +} + export default connect(mapStateToProps)(MetricsFetchControls);