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

20 lines
451 B
TypeScript
Raw Normal View History

2017-06-29 12:54:02 -06:00
import * as React from "react";
interface Props {
onClick: Function;
disabled: boolean;
2018-03-19 08:16:04 -06:00
children?: React.ReactNode;
2020-02-28 09:34:28 -07:00
title?: string;
2017-06-29 12:54:02 -06:00
}
2020-02-28 09:34:28 -07:00
export function LockableButton({ onClick, disabled, children, title }: Props) {
2017-08-28 05:49:13 -06:00
const className = disabled ? "gray" : "yellow";
2017-06-29 12:54:02 -06:00
return <button
className={"fb-button " + className}
disabled={disabled}
2020-02-28 09:34:28 -07:00
title={title}
2019-09-23 12:56:35 -06:00
onClick={() => disabled ? "" : onClick()}>
2017-06-29 12:54:02 -06:00
{children}
</button>;
2017-08-23 16:26:09 -06:00
}