- Default status-page colour now uses the brand green instead of a royal-blue hex - PageSpeed API-key alert pulls from theme.palette.warning + alpha for both modes instead of hand-rolled amber values - Settings JSON preview block uses action.hover instead of the hand-rolled #1e1e1e/#f5f5f5 pair - Drop the redundant #E0E0E0 thumb override on SwitchComponent so the theme MuiSwitch override actually wins
40 lines
862 B
TypeScript
40 lines
862 B
TypeScript
import { forwardRef } from "react";
|
|
import Switch from "@mui/material/Switch";
|
|
import type { SwitchProps } from "@mui/material/Switch";
|
|
import { useTheme } from "@mui/material/styles";
|
|
|
|
interface SwitchComponentProps extends SwitchProps {
|
|
dualOption?: boolean;
|
|
}
|
|
|
|
export const SwitchComponent = forwardRef<HTMLInputElement, SwitchComponentProps>(
|
|
function SwitchComponent({ sx, dualOption = false, ...props }, ref) {
|
|
const theme = useTheme();
|
|
const additionalSx = Array.isArray(sx) ? sx : sx ? [sx] : [];
|
|
|
|
return (
|
|
<Switch
|
|
{...props}
|
|
slotProps={{
|
|
input: {
|
|
ref: ref,
|
|
},
|
|
}}
|
|
sx={[
|
|
...(dualOption
|
|
? [
|
|
{
|
|
"& .MuiSwitch-track": {
|
|
backgroundColor: theme.palette.primary.main,
|
|
opacity: 1,
|
|
},
|
|
},
|
|
]
|
|
: []),
|
|
...additionalSx,
|
|
]}
|
|
/>
|
|
);
|
|
}
|
|
);
|