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

18 lines
408 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;
2017-06-29 12:54:02 -06:00
}
export function LockableButton({ onClick, disabled, children }: 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}
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
}