openreplay/frontend/app/layout/Layout.tsx
Shekar Siri 8facbb9d6e
change(ui) - navigation (#1427)
* change(ui): route refactor

* change(ui): new navigation

* change(ui): new navigation - icons and other fixes
2023-07-27 12:40:36 +02:00

58 lines
1.6 KiB
TypeScript

import React from 'react';
import { Layout as AntLayout } from 'antd';
import SideMenu from 'App/layout/SideMenu';
import TopHeader from 'App/layout/TopHeader';
const { Header, Sider, Content } = AntLayout;
interface Props {
children: React.ReactNode;
hideHeader?: boolean;
siteId?: string;
}
function Layout(props: Props) {
const { hideHeader, siteId } = props;
const isPlayer = /\/(session|assist)\//.test(window.location.pathname);
return (
<AntLayout style={{ minHeight: '100vh' }}>
{!hideHeader && (
<Header
style={{
position: 'sticky',
top: 0,
zIndex: 1,
padding: '0 15px',
display: 'flex',
alignItems: 'center',
height: '60px'
}}
className='justify-between bg-gray-lightest'
>
<TopHeader />
</Header>
)}
<AntLayout>
{!hideHeader && (
<Sider
style={{
position: 'sticky',
top: 60, // Height of the Header
backgroundColor: '#f6f6f6',
height: 'calc(100vh - 80px)', // Adjust the height to accommodate the Header
overflow: 'auto' // Enable scrolling for the Sider content if needed
}}
width={250}
>
<SideMenu siteId={siteId} />
</Sider>
)}
<Content style={{ padding: isPlayer ? '0' : '20px', minHeight: 'calc(100vh - 50px)' }}>
{props.children}
</Content>
</AntLayout>
</AntLayout>
);
}
export default Layout;