Farmbot-Web-App/frontend/devices/components/boolean_mcu_input_group.tsx

66 lines
1.8 KiB
TypeScript
Raw Normal View History

2017-06-29 12:54:02 -06:00
import * as React from "react";
import { ToggleButton } from "../../controls/toggle_button";
import { settingToggle } from "../actions";
2019-09-19 07:41:37 -06:00
import { Row, Col, Help } from "../../ui/index";
2017-06-29 12:54:02 -06:00
import { BooleanMCUInputGroupProps } from "./interfaces";
2019-09-19 07:41:37 -06:00
import { Position } from "@blueprintjs/core";
2017-06-29 12:54:02 -06:00
export function BooleanMCUInputGroup(props: BooleanMCUInputGroupProps) {
2017-08-28 05:49:13 -06:00
const {
2017-06-29 12:54:02 -06:00
tooltip,
name,
x,
y,
z,
2018-01-29 13:53:24 -07:00
disable,
grayscale,
2017-08-11 17:14:55 -06:00
caution,
2018-03-09 02:34:24 -07:00
displayAlert,
sourceFwConfig,
dispatch,
2017-06-29 12:54:02 -06:00
} = props;
2018-03-09 02:34:24 -07:00
const xParam = sourceFwConfig(x);
const yParam = sourceFwConfig(y);
const zParam = sourceFwConfig(z);
2017-06-29 12:54:02 -06:00
return <Row>
2019-09-19 07:41:37 -06:00
<Col xs={6} className={"widget-body-tooltips"}>
<label>
{name}
{caution &&
<i className="fa fa-exclamation-triangle caution-icon" />}
</label>
2019-09-19 07:41:37 -06:00
<Help text={tooltip} requireClick={true} position={Position.RIGHT} />
</Col>
2018-01-29 11:32:32 -07:00
<Col xs={2} className={"centered-button-div"}>
<ToggleButton
2020-01-03 13:04:45 -07:00
grayscale={grayscale?.x}
disabled={disable?.x}
2018-03-09 02:34:24 -07:00
dim={!xParam.consistent}
toggleValue={xParam.value}
toggleAction={() =>
dispatch(settingToggle(x, sourceFwConfig, displayAlert))} />
</Col>
2018-01-29 11:32:32 -07:00
<Col xs={2} className={"centered-button-div"}>
<ToggleButton
2020-01-03 13:04:45 -07:00
grayscale={grayscale?.y}
disabled={disable?.y}
2018-03-09 02:34:24 -07:00
dim={!yParam.consistent}
toggleValue={yParam.value}
toggleAction={() =>
dispatch(settingToggle(y, sourceFwConfig, displayAlert))} />
</Col>
2018-01-29 11:32:32 -07:00
<Col xs={2} className={"centered-button-div"}>
<ToggleButton
2020-01-03 13:04:45 -07:00
grayscale={grayscale?.z}
disabled={disable?.z}
2018-03-09 02:34:24 -07:00
dim={!zParam.consistent}
toggleValue={zParam.value}
toggleAction={() =>
dispatch(settingToggle(z, sourceFwConfig, displayAlert))} />
</Col>
</Row>;
2017-06-29 12:54:02 -06:00
}