diff --git a/src/blueapi/BlueapiComponents.tsx b/src/blueapi/BlueapiComponents.tsx index 0e40b1d..147e7fc 100644 --- a/src/blueapi/BlueapiComponents.tsx +++ b/src/blueapi/BlueapiComponents.tsx @@ -13,6 +13,7 @@ import { parseInstrumentSession, readVisitFromPv } from "./visit"; type SeverityLevel = "success" | "info" | "warning" | "error"; type VariantChoice = "outlined" | "contained"; type ButtonSize = "small" | "medium" | "large"; +type ButtonColor = "primary" | "secondary" | "custom"; type RunPlanButtonProps = { btnLabel: string; @@ -21,20 +22,20 @@ type RunPlanButtonProps = { title?: string; btnVariant?: VariantChoice; btnSize?: ButtonSize; + btnColor?: ButtonColor; + disabled?: boolean; + sx?: object; + tooltipSx?: object; + typographySx?: object; }; -// @{todo} Ideally we should be able to set up the stylings for -// a custom button in the proper way by doing something like: -// const CustomRunButton = styled(Button)({ -// width: "100%", -// height: "85%", -// color: "var(--color)", -// backgroundColor: "var(--backgroundColor)", -// padding: "var(--padding)", -// margin: "var(--margin)", -// }); -// This will be another PR -// See https://github.com/DiamondLightSource/mx-daq-ui/issues/71 +const buttonStyles = { + color: "white", + padding: "12px", + backgroundColor: "#1c2025", + width: "90%", + height: "85%", +}; export function RunPlanButton(props: RunPlanButtonProps) { const [openSnackbar, setOpenSnackbar] = React.useState(false); @@ -47,6 +48,10 @@ export function RunPlanButton(props: RunPlanButtonProps) { const params = props.planParams ? props.planParams : {}; const variant = props.btnVariant ? props.btnVariant : "outlined"; const size = props.btnSize ? props.btnSize : "medium"; + const color = props.btnColor ? props.btnColor : "primary"; + const disabled = props.disabled ? props.disabled : false; + const sx = props.sx ? { ...buttonStyles, ...props.sx } : buttonStyles; // Style for the button component which is the most likely to be customised + const tooltipSx = props.tooltipSx ? props.tooltipSx : {}; const handleClick = () => { setOpenSnackbar(true); @@ -85,18 +90,25 @@ export function RunPlanButton(props: RunPlanButtonProps) { return (
- + diff --git a/src/screens/OavMover.tsx b/src/screens/OavMover.tsx index b7bb9cd..1656199 100644 --- a/src/screens/OavMover.tsx +++ b/src/screens/OavMover.tsx @@ -33,13 +33,6 @@ import oxfordChipDiagram from "../assets/Oxford Chip Diagram.excalidraw.svg"; import { RunPlanButton } from "../blueapi/BlueapiComponents"; import { parseInstrumentSession, readVisitFromPv } from "../blueapi/visit"; -const buttonStyle = { - color: "white", - margin: "5px", - padding: "15px", - backgroundColor: "#1c2025", -}; - function BacklightControl(props: PvDescription) { const theme = useTheme(); return ( @@ -241,7 +234,15 @@ export function PresetPositionsSideDrawer() { return ( <> - @@ -261,14 +262,6 @@ export function CoordinateSystem() { setOpen(false); }; - // const buttonStyle = { - // color: "white", - // padding: "12px", - // backgroundColor: "#1c2025", - // width: "100%", - // height: "85%", - // }; - return ( <>