Skip to content

Commit

Permalink
🪡 [UI] Fix Header Position
Browse files Browse the repository at this point in the history
🪡 [UI] Fix Header Position
  • Loading branch information
KaradzaJuraj authored Jan 27, 2024
2 parents 5f18350 + 02bd16f commit c1345d7
Show file tree
Hide file tree
Showing 2 changed files with 101 additions and 58 deletions.
61 changes: 41 additions & 20 deletions cyclops-ui/src/components/layouts/AppLayout.tsx
Original file line number Diff line number Diff line change
@@ -1,24 +1,45 @@
import {Outlet} from "react-router-dom";
import { Outlet } from "react-router-dom";
import SideNav from "./Sidebar";
import {Suspense} from "react";
import { Suspense } from "react";
import Sider from "antd/es/layout/Sider";
import {Content, Header} from "antd/es/layout/layout";
import {Layout} from 'antd';
import { Content, Header } from "antd/es/layout/layout";
import { Layout } from "antd";

export default function AppLayout() {
return (
<Layout>
<Sider>
<SideNav/>
</Sider>
<Layout>
<Header/>
<Content style={{padding: 24, minHeight: "calc(100vh - 112px)", background: "#fff"}}>
<Suspense fallback={<h1 style={{textAlign: "center"}}>Loading...</h1>}>
<Outlet/>
</Suspense>
</Content>
</Layout>
</Layout>
)
}
return (
<Layout style={{ minHeight: "100vh" }}>
<Sider
width={200}
style={{
position: "fixed",
height: "100%",
}}
>
<SideNav />
</Sider>
<Layout style={{ marginLeft: 200 }}>
<Header
style={{
position: "fixed",
width: "100%",
zIndex: 1,
}}
/>
<Content
style={{
marginTop: 64,
padding: 24,
minHeight: "calc(100vh - 112px)",
background: "#fff",
}}
>
<Suspense
fallback={<h1 style={{ textAlign: "center" }}>Loading...</h1>}
>
<Outlet />
</Suspense>
</Content>
</Layout>
</Layout>
);
}
98 changes: 60 additions & 38 deletions cyclops-ui/src/components/layouts/Sidebar.tsx
Original file line number Diff line number Diff line change
@@ -1,44 +1,66 @@
import React from 'react';
import {Button, Menu, MenuProps} from 'antd';
import {AppstoreAddOutlined, HddOutlined, BugFilled} from '@ant-design/icons';
import {useLocation} from 'react-router';
import React from "react";
import { Button, Menu, MenuProps } from "antd";
import { AppstoreAddOutlined, HddOutlined, BugFilled } from "@ant-design/icons";
import { useLocation } from "react-router";
import PathConstants from "../../routes/PathConstants";
import { Link } from 'react-router-dom';

import { Link } from "react-router-dom";

const SideNav = () => {
const location = useLocation().pathname.split('/')[1]

const sidebarItems: MenuProps['items'] = [{
label: <Link to={PathConstants.MODULES}> Modules</Link>,
icon: <AppstoreAddOutlined/>,
key: 'modules'
}, {
label: <Link to={PathConstants.NODES}> Nodes</Link>,
icon: <HddOutlined/>,
key: 'nodes'
}];
const location = useLocation().pathname.split("/")[1];

const sidebarItems: MenuProps["items"] = [
{
label: <Link to={PathConstants.MODULES}> Modules</Link>,
icon: <AppstoreAddOutlined />,
key: "modules",
},
{
label: <Link to={PathConstants.NODES}> Nodes</Link>,
icon: <HddOutlined />,
key: "nodes",
},
];

return (
<div style={{ display: 'flex', flexDirection: 'column', minHeight: '100vh' }} >
<a href={PathConstants.MODULES}>
<div style={{height: "32px", width: "70%", margin: "0.9rem 1rem 0.6rem 2rem", display: "inline-flex"}}>
<h2 style={{color: "white", marginTop: "5px"}}><b>Cyclops</b></h2>
<img style={{height: "120%", marginLeft: "6px"}}
src={require("./KIKLOPcic.png")} alt="Cyclops" />
</div>
</a>
<Menu theme="dark" mode="inline" selectedKeys={[location]} items={sidebarItems}/>
<Button
ghost
style={{ margin: 'auto 25px 25px 25px'}}
icon={ <BugFilled/> }
href={"https://github.com/cyclops-ui/cyclops/issues/new?assignees=&labels=&projects=&template=bug_report.md&title="}
>
<b>Report a Bug</b>
</Button>
return (
<div
style={{ display: "flex", flexDirection: "column", minHeight: "100vh" }}
>
<a href={PathConstants.MODULES}>
<div
style={{
height: "32px",
width: "70%",
margin: "0.9rem 1rem 0.6rem 2rem",
display: "inline-flex",
}}
>
<h2 style={{ color: "white", marginTop: "5px" }}>
<b>Cyclops</b>
</h2>
<img
style={{ height: "120%", marginLeft: "6px" }}
src={require("./KIKLOPcic.png")}
alt="Cyclops"
/>
</div>
);
}
export default SideNav;
</a>
<Menu
theme="dark"
mode="inline"
selectedKeys={[location]}
items={sidebarItems}
/>
<Button
ghost
style={{ margin: "auto 25px 25px 25px" }}
icon={<BugFilled />}
href={
"https://github.com/cyclops-ui/cyclops/issues/new?assignees=&labels=&projects=&template=bug_report.md&title="
}
>
<b>Report a Bug</b>
</Button>
</div>
);
};
export default SideNav;

0 comments on commit c1345d7

Please sign in to comment.