This repository has been archived on 2022-05-10. You can view files and clone it, but cannot push or open issues or pull requests.
tghandbook/lib/App.tsx

23 lines
649 B
TypeScript
Raw Normal View History

2020-06-16 09:32:48 +00:00
import * as React from "react";
import WikiPage from "./components/WikiPage";
2020-06-16 15:08:44 +00:00
import TabList, { TabListItem } from "./components/TabList";
import { useState } from "react";
2020-06-16 09:32:48 +00:00
export default function App() {
2020-06-16 15:08:44 +00:00
const [tabs, setTabs] = useState<TabListItem[]>([
{ page: "Guide_to_medicine" },
// { page: "Guide_to_chemistry" },
]);
const [activeTab, setActiveTab] = useState(0);
2020-06-16 09:32:48 +00:00
return (
<React.Fragment>
2020-06-16 15:08:44 +00:00
<TabList tabs={tabs} active={activeTab} />
2020-06-16 09:32:48 +00:00
<section id="tabs">
2020-06-16 15:08:44 +00:00
{tabs.map((tab, i) => (
<WikiPage page={tab.page} visible={activeTab == i} />
))}
2020-06-16 09:32:48 +00:00
</section>
</React.Fragment>
);
}