mirror of
https://github.com/bitburner-official/bitburner-src.git
synced 2026-04-25 02:32:55 +02:00
BITNODE: IPvGO territory control strategy game (#934)
This commit is contained in:
committed by
GitHub
parent
c6141f2adf
commit
7ef12a0323
@@ -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>}>
|
||||
|
||||
Reference in New Issue
Block a user