signoz/frontend/src/modules/AppLayout.tsx
palash-signoz 9008d19a7b
fix(FE): AppRoutes is refactored (#260)
* react-app-env.d.ts is moved to the typings

* webpack config for development and production is updated

* extra browser router component is removed

* loable component is made

* spinner component is updated

* route are updated

* routes are imported is Loadable fashion with chunkName

* AppRoute is updated

* AppWrapper is changed to AppRouter

* merge conflits are resolved

* Loadable component is updated

Co-authored-by: Ankit Nayan <ankit@signoz.io>
2021-08-23 11:38:25 +05:30

40 lines
930 B
TypeScript

import React, { ReactNode, useEffect } from "react";
import { Layout } from "antd";
import SideNav from "./Nav/SideNav";
import TopNav from "./Nav/TopNav";
import { useLocation } from "react-router-dom";
import { useRoute } from "./RouteProvider";
const { Content, Footer } = Layout;
interface BaseLayoutProps {
children: ReactNode;
}
const BaseLayout: React.FC<BaseLayoutProps> = ({ children }) => {
const location = useLocation();
const { dispatch } = useRoute();
useEffect(() => {
dispatch({ type: "ROUTE_IS_LOADED", payload: location.pathname });
}, [location]);
return (
<Layout style={{ minHeight: "100vh" }}>
<SideNav />
<Layout className="site-layout">
<Content style={{ margin: "0 16px" }}>
<TopNav />
{children}
</Content>
<Footer style={{ textAlign: "center", fontSize: 10 }}>
SigNoz Inc. ©2020
</Footer>
</Layout>
</Layout>
);
};
export default BaseLayout;