Farmbot-Web-App/frontend/ui/help.tsx

27 lines
757 B
TypeScript
Raw Normal View History

2017-06-29 12:54:02 -06:00
import * as React from "react";
2020-03-13 15:21:44 -06:00
import {
Popover, PopoverInteractionKind, PopoverPosition, Position,
} from "@blueprintjs/core";
2019-07-02 11:03:16 -06:00
import { t } from "../i18next_wrapper";
2017-06-29 12:54:02 -06:00
interface HelpProps {
text: string;
2020-03-13 15:21:44 -06:00
onHover?: boolean;
2019-09-19 07:41:37 -06:00
position?: PopoverPosition;
2020-01-03 13:17:56 -07:00
customIcon?: string;
2020-04-13 13:24:38 -06:00
customClass?: string;
2017-06-29 12:54:02 -06:00
}
export function Help(props: HelpProps) {
2017-08-28 05:44:37 -06:00
return <Popover
2020-03-13 15:21:44 -06:00
position={props.position || Position.TOP_RIGHT}
interactionKind={props.onHover
? PopoverInteractionKind.HOVER
: PopoverInteractionKind.CLICK}
2020-04-13 13:24:38 -06:00
className={props.customClass}
2019-09-23 12:56:35 -06:00
popoverClassName={"help"}>
2020-01-03 13:17:56 -07:00
<i className={`fa fa-${props.customIcon || "question-circle"} help-icon`} />
2020-02-28 09:34:28 -07:00
<div className={"help-text-content"}>{t(props.text)}</div>
2017-08-28 05:44:37 -06:00
</Popover>;
2017-06-29 12:54:02 -06:00
}