Add activeTab to local state

This commit is contained in:
Chi Vinh Le
2018-09-13 18:29:22 +02:00
parent db483849dd
commit ecc9eadc67
23 changed files with 120 additions and 44 deletions
+10 -8
View File
@@ -3,20 +3,22 @@ import { StatelessComponent } from "react";
import { Flex } from "talk-ui/components";
import PermalinkViewQuery from "../tabs/comments/queries/PermalinkViewQuery";
import StreamQuery from "../tabs/comments/queries/StreamQuery";
import CommentsPaneContainer from "../tabs/comments/containers/CommentsPaneContainer";
import * as styles from "./App.css";
export interface AppProps {
showPermalinkView: boolean;
activeTab: "COMMENTS" | "%future added value";
}
const App: StatelessComponent<AppProps> = props => {
const view = props.showPermalinkView ? (
<PermalinkViewQuery />
) : (
<StreamQuery />
);
let view: React.ReactElement<any>;
switch (props.activeTab) {
case "COMMENTS":
view = <CommentsPaneContainer />;
break;
default:
throw new Error(`Unknown tab ${props.activeTab}`);
}
return (
<Flex justifyContent="center" className={styles.root}>
{view}