diff --git a/src/components/SelectableFab.tsx b/src/components/SelectableFab.tsx new file mode 100644 index 0000000..00ac908 --- /dev/null +++ b/src/components/SelectableFab.tsx @@ -0,0 +1,47 @@ +import { Fab, styled, type FabProps } from "@mui/material" + +const StyledSelectableFab = styled(Fab, { + shouldForwardProp: (prop) => prop !== "selected", +})(({ theme }) => ({ + borderRadius: "20px", + + "&:hover": { + background: theme.palette.backgroundPaperElevation?.[7], + }, + + variants: [ + { + props: ({ selected }) => !selected, + style: { + background: theme.palette.backgroundPaperElevation?.[0], + color: theme.palette.action.disabled, + "> img": { + opacity: 0.4, + }, + }, + }, + { + props: ({ selected }) => selected, + style: { + background: theme.palette.backgroundPaperElevation?.[11], + border: `1px solid ${theme.palette.divider}`, + color: theme.palette.primary.contrastText, + }, + }, + ], +})) + +type CodeFabProps = { + selected?: boolean +} & Omit + +export function SelectableFab({ selected, ...props }: CodeFabProps) { + return ( + + ) +} diff --git a/src/components/VelocitySlider.tsx b/src/components/VelocitySlider.tsx index ba4bc9f..b7507ff 100644 --- a/src/components/VelocitySlider.tsx +++ b/src/components/VelocitySlider.tsx @@ -40,6 +40,7 @@ export const VelocitySlider = observer((props: VelocitySliderProps) => { { const { t } = useTranslation() + const theme = useTheme() function renderOverlay() { if (store.activationState === "inactive" && !store.activationError) { @@ -16,7 +17,7 @@ export const JoggingActivationRequired = observer( + + @@ -102,27 +113,29 @@ export const JoggingCartesianAxisControl = externalizeComponent( - + + ) }, diff --git a/src/components/jogging/JoggingCartesianTab.tsx b/src/components/jogging/JoggingCartesianTab.tsx index 1f7ff41..175c499 100644 --- a/src/components/jogging/JoggingCartesianTab.tsx +++ b/src/components/jogging/JoggingCartesianTab.tsx @@ -3,10 +3,10 @@ import { ToggleButton, ToggleButtonGroup, Typography, + useTheme, } from "@mui/material" import { degreesToRadians, radiansToDegrees } from "@wandelbots/wandelbots-js" import { observer } from "mobx-react-lite" -import type { ReactNode } from "react" import { useTranslation } from "react-i18next" import XAxisIcon from "../../icons/axis-x.svg" import YAxisIcon from "../../icons/axis-y.svg" @@ -28,8 +28,15 @@ type JoggingCartesianOpts = { } export const JoggingCartesianTab = observer( - ({ store, children }: { store: JoggingStore; children?: ReactNode }) => { + ({ + store, + children, + }: { + store: JoggingStore + children?: React.ReactNode + }) => { const { t } = useTranslation() + const theme = useTheme() function onMotionTypeChange( _event: React.MouseEvent, @@ -119,17 +126,17 @@ export const JoggingCartesianTab = observer( const axisList = [ { id: "x", - color: "#F14D42", + colors: theme.componentsExt?.JoggingCartesian?.Axis?.X, icon: , }, { id: "y", - color: "#42A705", + colors: theme.componentsExt?.JoggingCartesian?.Axis?.Y, icon: , }, { id: "z", - color: "#0075FF", + colors: theme.componentsExt?.JoggingCartesian?.Axis?.Z, icon: , }, ] as const @@ -145,7 +152,7 @@ export const JoggingCartesianTab = observer( } return ( - + {/* Show Wandelscript string for the current coords */} @@ -169,6 +176,7 @@ export const JoggingCartesianTab = observer( onChange={onMotionTypeChange} exclusive aria-label={t("Jogging.Cartesian.MotionType.lb")} + sx={{ justifyContent: "center" }} > {t("Jogging.Cartesian.Translation.bt")} @@ -194,7 +202,7 @@ export const JoggingCartesianTab = observer( axisList.map((axis) => ( @@ -231,7 +239,7 @@ export const JoggingCartesianTab = observer( axisList.map((axis) => ( diff --git a/src/components/jogging/JoggingOptions.tsx b/src/components/jogging/JoggingOptions.tsx index 5ac7d25..2a63b8f 100644 --- a/src/components/jogging/JoggingOptions.tsx +++ b/src/components/jogging/JoggingOptions.tsx @@ -44,6 +44,8 @@ export const JoggingOptions = observer(({ store }: { store: JoggingStore }) => { { store.setSelectedTcpId(event.target.value as string) }} @@ -92,7 +96,7 @@ export const JoggingOptions = observer(({ store }: { store: JoggingStore }) => { }} > {/* Orientation */} - + {t("Jogging.Cartesian.Orientation.lb")} @@ -103,20 +107,22 @@ export const JoggingOptions = observer(({ store }: { store: JoggingStore }) => { aria-labelledby="orientation-select" disabled={store.isLocked} > - + - + {/* Increment selection */} - + {"Increment"}