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

33 lines
1.0 KiB
TypeScript
Raw Permalink Normal View History

2019-01-09 19:28:37 -07:00
import * as React from "react";
import {
2020-02-28 09:35:32 -07:00
Widget, WidgetBody, WidgetHeader, docLink, DOC_SLUGS, DocSlug,
2019-01-09 19:28:37 -07:00
} from "../ui";
2019-04-02 13:59:37 -06:00
import { t } from "../i18next_wrapper";
2019-01-09 19:28:37 -07:00
const documentationLink = (slug: DocSlug, label: string) =>
<a href={docLink(slug)}
target="_blank">
{t(label)}<i className="fa fa-external-link" />
</a>;
const documentationLinkMapper = ([slug, label]: [DocSlug, string]) =>
slug !== "the-farmbot-web-app" &&
<div key={slug}>{documentationLink(slug, label)}</div>;
export const DocsWidget = () =>
<Widget className="documentation-widget">
<WidgetHeader title={t("Documentation")} />
<WidgetBody>
2020-02-28 09:34:28 -07:00
<div className={"general-doc-links"}>
2019-01-09 19:28:37 -07:00
<label>{t("General")}</label>
2020-02-28 09:34:28 -07:00
<div className={"web-app-doc-link"}>
{documentationLink("the-farmbot-web-app", "Web App")}
</div>
2019-01-09 19:28:37 -07:00
</div>
2020-02-28 09:34:28 -07:00
<div className={"specific-doc-links"}>
2019-01-09 19:28:37 -07:00
<label>{t("Topics")}</label>
{Object.entries(DOC_SLUGS).map(documentationLinkMapper)}
</div>
</WidgetBody>
</Widget>;