You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
31 lines
765 B
31 lines
765 B
import React from 'react';
|
|
import {HookRouter, navigate, usePath, useRoutes} from "hookrouter";
|
|
import {Tabs} from "./primitives/Layout";
|
|
|
|
const routeObj: HookRouter.RouteObject = {
|
|
"/": () => <div>1</div>,
|
|
"/devices": () => <div>2</div>,
|
|
"/settings": () => <div>3</div>,
|
|
}
|
|
|
|
const routeList = ["/", "/devices", "/settings"];
|
|
|
|
const tabNames = ["Lucifer", "Enheter", "Oppsett"];
|
|
|
|
function App() {
|
|
const route = useRoutes(routeObj);
|
|
const path = usePath();
|
|
|
|
return (
|
|
<div className="App">
|
|
<Tabs tabNames={tabNames}
|
|
index={routeList.indexOf(path)}
|
|
onChange={i => navigate(routeList[i])}
|
|
boldIndex={0}
|
|
/>
|
|
{route || <div>B</div>}
|
|
</div>
|
|
);
|
|
}
|
|
|
|
export default App;
|