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 {
|
2018-03-19 06:57:49 -06:00
|
|
|
children?: React.ReactNode;
|
2017-06-29 12:54:02 -06:00
|
|
|
helpText?: string;
|
2018-01-12 14:42:12 -07:00
|
|
|
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>;
|
|
|
|
}
|