Show FB internal instructions by default on "Getting Started" page

Summary:
Show internal instructions for Flipper setup by default on "Getting Started" page. This is a follow up to https://fb.workplace.com/groups/flippersupport/permalink/955763464904312/.

I used tabs component to show both internal and external content in tabs. By default, internal content is shown, but it is possible to also switch to external.

Reviewed By: jknoxville

Differential Revision: D23649955

fbshipit-source-id: c4f956e0ee9fec69cf861d96a447f934f746dd7f
This commit is contained in:
Anton Nikolaev
2020-09-11 09:48:04 -07:00
committed by Facebook GitHub Bot
parent 1f62ce32bf
commit 12d7b48443
4 changed files with 66 additions and 10 deletions

View File

@@ -0,0 +1,48 @@
/**
* Copyright (c) Facebook, Inc. and its affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
* @format
*/
import React from 'react';
import {isInternal} from 'internaldocs-fb-helpers';
import Tabs from '@theme/Tabs';
import TabItem from '@theme/TabItem';
function createElement(createElement) {
if (!createElement) return undefined;
if (React.isValidElement(createElement)) {
return createElement;
}
const element = createElement();
if (React.isValidElement(element)) {
return element;
}
return React.createElement(element.default || element, {});
}
function FBContent({internal, external}) {
if (!isInternal()) {
return createElement(external);
}
if (internal && external) {
return (
<Tabs
defaultValue="internal-docs"
values={[
{label: 'FB Internal', value: 'internal-docs'},
{label: 'Open-Source', value: 'external-docs'},
]}>
<TabItem value="internal-docs">{createElement(internal)}</TabItem>
<TabItem value="external-docs">{createElement(external)}</TabItem>
</Tabs>
);
} else {
return createElement(internal || external);
}
}
export default FBContent;