Farmbot-Web-App/frontend/devices/components/fbos_settings/fbos_button_row.tsx

43 lines
1.1 KiB
TypeScript
Raw Normal View History

2018-09-24 13:34:38 -06:00
import * as React from "react";
import { Row, Col } from "../../../ui";
import { ColWidth } from "../farmbot_os_settings";
2019-04-02 13:59:37 -06:00
import { t } from "../../../i18next_wrapper";
2020-02-18 12:21:09 -07:00
import { Highlight } from "../maybe_highlight";
import { DeviceSetting } from "../../../constants";
2018-09-24 13:34:38 -06:00
export interface FbosButtonRowProps {
botOnline: boolean;
2020-02-18 12:21:09 -07:00
label: DeviceSetting;
2018-09-24 13:34:38 -06:00
description: string;
buttonText: string;
color: string;
action: () => void;
}
export const FbosButtonRow = (props: FbosButtonRowProps) => {
return <Row>
2020-02-18 12:21:09 -07:00
<Highlight settingName={props.label}>
<Col xs={ColWidth.label}>
<label>
{t(props.label)}
</label>
</Col>
<Col xs={ColWidth.description}>
<p>
{t(props.description)}
</p>
</Col>
<Col xs={ColWidth.button}>
<button
className={`fb-button ${props.color}`}
type="button"
onClick={props.action}
2020-02-28 09:34:28 -07:00
title={t(props.buttonText)}
2020-02-18 12:21:09 -07:00
disabled={!props.botOnline}>
{t(props.buttonText)}
</button>
</Col>
</Highlight>
2018-09-24 13:34:38 -06:00
</Row>;
};