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

24 lines
617 B
TypeScript
Raw Permalink Normal View History

2017-06-29 12:54:02 -06:00
import * as React from "react";
2019-09-26 04:44:51 -06:00
import { DocSlug } from "./doc_link";
2019-04-02 13:59:37 -06:00
import { t } from "../i18next_wrapper";
2019-09-26 04:44:51 -06:00
import { ToolTip } from "./tooltip";
2019-12-26 13:20:10 -07:00
import { ErrorBoundary } from "../error_boundary";
2017-06-29 12:54:02 -06:00
interface WidgetHeaderProps {
children?: React.ReactNode;
2017-06-29 12:54:02 -06:00
helpText?: string;
docPage?: DocSlug;
2017-06-29 12:54:02 -06:00
title: string;
}
export function WidgetHeader(props: WidgetHeaderProps) {
return <div className="widget-header">
2019-12-26 13:20:10 -07:00
<ErrorBoundary>
{props.children}
</ErrorBoundary>
2017-06-29 12:54:02 -06:00
<h5>{t(props.title)}</h5>
{props.helpText &&
2019-10-08 13:23:39 -06:00
<ToolTip helpText={props.helpText} docPage={props.docPage} />}
2017-06-29 12:54:02 -06:00
</div>;
}