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

31 lines
758 B
TypeScript
Raw Normal View History

2018-06-14 12:48:30 -06:00
import * as React from "react";
2018-06-21 15:04:21 -06:00
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 CenterProps {
children?: React.ReactNode;
className: string;
title: string;
helpText?: string;
2018-06-14 12:48:30 -06:00
width?: number;
2018-06-21 15:04:21 -06:00
docPage?: DocSlug;
2019-04-11 21:17:18 -06:00
backButton?: React.ReactNode;
2018-06-14 12:48:30 -06:00
}
export function CenterPanel(props: CenterProps) {
2018-12-03 14:36:43 -07:00
return <Col sm={props.width || 6} lg={6}>
2018-06-14 12:48:30 -06:00
<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>
{props.helpText &&
2019-12-26 13:20:10 -07:00
<ToolTip helpText={t(props.helpText)} docPage={props.docPage} />}
<ErrorBoundary>
{props.children}
</ErrorBoundary>
2018-06-14 12:48:30 -06:00
</div>
</Col>;
}