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

32 lines
802 B
TypeScript
Raw Permalink Normal View History

2018-06-14 12:48:30 -06:00
import * as React from "react";
import { Col, ToolTip, DocSlug } from ".";
2019-04-02 13:59:37 -06:00
import { t } from "../i18next_wrapper";
2019-12-26 13:20:10 -07:00
import { ErrorBoundary } from "../error_boundary";
2019-04-02 13:59:37 -06:00
2018-06-14 12:48:30 -06:00
interface RightPanelProps {
children?: React.ReactNode;
className: string;
title: string;
helpText: string;
docPage?: DocSlug;
2018-06-14 12:48:30 -06:00
show: Boolean | undefined;
width?: number;
2019-04-11 21:17:18 -06:00
backButton?: React.ReactNode;
2018-06-14 12:48:30 -06:00
}
export function RightPanel(props: RightPanelProps) {
2018-12-03 14:36:43 -07:00
return <Col sm={props.width || 3} lg={3}>
2018-06-14 12:48:30 -06:00
{props.show &&
<div className={props.className}>
2019-04-11 21:17:18 -06:00
{props.backButton}
2018-06-14 12:48:30 -06:00
<h3>
<i>{t(props.title)}</i>
</h3>
<ToolTip helpText={props.helpText} docPage={props.docPage} />
2019-12-26 13:20:10 -07:00
<ErrorBoundary>
{props.children}
</ErrorBoundary>
2018-06-14 12:48:30 -06:00
</div>}
</Col>;
}