BITNODE: IPvGO territory control strategy game (#934)

This commit is contained in:
Michael Ficocelli
2023-12-26 11:45:27 -05:00
committed by GitHub
parent c6141f2adf
commit 7ef12a0323
68 changed files with 7833 additions and 17 deletions
+9 -1
View File
@@ -3,12 +3,19 @@ import React, { useState } from "react";
type OptionSwitchProps = {
checked: boolean;
disabled?: boolean;
onChange: (newValue: boolean, error?: string) => void;
text: React.ReactNode;
tooltip: React.ReactNode;
};
export function OptionSwitch({ checked, onChange, text, tooltip }: OptionSwitchProps): React.ReactElement {
export function OptionSwitch({
checked,
disabled = false,
onChange,
text,
tooltip,
}: OptionSwitchProps): React.ReactElement {
const [value, setValue] = useState(checked);
function handleSwitchChange(event: React.ChangeEvent<HTMLInputElement>): void {
@@ -20,6 +27,7 @@ export function OptionSwitch({ checked, onChange, text, tooltip }: OptionSwitchP
return (
<>
<FormControlLabel
disabled={disabled}
control={<Switch checked={value} onChange={handleSwitchChange} />}
label={
<Tooltip title={<Typography>{tooltip}</Typography>}>