-
Notifications
You must be signed in to change notification settings - Fork 771
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
🪡 [UI] Fix Header Position
- Loading branch information
Showing
2 changed files
with
101 additions
and
58 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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> | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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; |