-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Also add placeholder publications and about pages Closes #33
- Loading branch information
Showing
10 changed files
with
186 additions
and
6 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
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
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 |
---|---|---|
@@ -0,0 +1,130 @@ | ||
import React, { useState } from "react"; | ||
import { ConfigProvider, Layout, Menu } from "antd"; | ||
import { useNavigate } from "react-router-dom"; | ||
|
||
const { Header } = Layout; | ||
|
||
const items = [ | ||
{ | ||
key: "home", | ||
label: "Home", | ||
path: "/" | ||
}, | ||
{ | ||
key: "search", | ||
label: "Search", | ||
children: [ | ||
{ | ||
key: "phenotype", | ||
label: "By Phenotype", | ||
path: "/phenotype" | ||
}, | ||
{ | ||
key: "celltype", | ||
label: "By Cell Type", | ||
path: "/celltype" | ||
}, | ||
{ | ||
key: "gene", | ||
label: "By Gene", | ||
path: "/gene" | ||
}, | ||
{ | ||
key: "severity", | ||
label: "By Severity", | ||
path: "/severity" | ||
}, | ||
], | ||
}, | ||
{ | ||
key: "publications", | ||
label: "Publications", | ||
path: "/publications" | ||
}, | ||
{ | ||
key: "about", | ||
label: "About", | ||
path: "/about" | ||
}, | ||
]; | ||
|
||
const CustomHeader = ({ activePageKey }) => { | ||
const [selectedKey, setSelectedKey] = useState(activePageKey); | ||
const navigate = useNavigate(); | ||
|
||
const handleMenuClick = (e) => { | ||
setSelectedKey(e.key); | ||
const item = findMenuItemByKey(items, e.key); | ||
console.log(item); | ||
if (item && item.path) { | ||
navigate(item.path); | ||
} | ||
} | ||
|
||
const findMenuItemByKey = (menuItems, key) => { | ||
for (const item of menuItems) { | ||
if (item.key === key) { | ||
return item; | ||
} | ||
if (item.children) { | ||
const childItem = findMenuItemByKey(item.children, key); | ||
if (childItem) { | ||
return childItem; | ||
} | ||
} | ||
} | ||
return null; | ||
}; | ||
|
||
return ( | ||
<ConfigProvider | ||
theme={{ | ||
components: { | ||
Menu: { | ||
darkItemColor: "#000", | ||
darkItemSelectedBg: "#8b5cf6", | ||
darkSubMenuItemBg: "#fff", | ||
darkPopupBg: "#fff", | ||
subMenuItemBg: "#fff", | ||
subMenuItemSelectedColor: "#fff", | ||
darkItemHoverColor: "#8b5cf6", | ||
}, | ||
Layout: { | ||
headerHeight: "3.2em", | ||
} | ||
}, | ||
}} | ||
> | ||
<Header | ||
style={{ | ||
background: "#fff", | ||
padding: 0, | ||
display: "flex", | ||
alignItems: "center", | ||
position: "relative", | ||
}} | ||
theme="light" | ||
> | ||
<p style={{ textAlign: "center", marginLeft: "2em" }}> | ||
Neurogenomics Lab | ||
</p> | ||
<Menu | ||
theme="dark" | ||
mode="horizontal" | ||
selectedKeys={[selectedKey]} | ||
items={items} | ||
className="header-menu" | ||
onClick={handleMenuClick} | ||
style={{ | ||
position: "absolute", | ||
left: "50%", | ||
transform: "translateX(-50%)", | ||
background: "#fff", | ||
}} | ||
/> | ||
</Header> | ||
</ConfigProvider> | ||
); | ||
}; | ||
|
||
export default CustomHeader; |
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 |
---|---|---|
@@ -0,0 +1,14 @@ | ||
import React from "react"; | ||
import CustomHeader from "../components/utilities/Header"; | ||
|
||
export default function AboutPage() { | ||
return ( | ||
<> | ||
<CustomHeader activePageKey="about" /> | ||
<div> | ||
<h1>About</h1> | ||
<p>Coming soon...</p> | ||
</div> | ||
</> | ||
); | ||
} |
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
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
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
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
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 |
---|---|---|
@@ -0,0 +1,14 @@ | ||
import React from "react"; | ||
import CustomHeader from "../components/utilities/Header"; | ||
|
||
export default function PublicationsPage() { | ||
return ( | ||
<> | ||
<CustomHeader activePageKey="publications" /> | ||
<div> | ||
<h1>Publications</h1> | ||
<p>Coming soon...</p> | ||
</div> | ||
</> | ||
); | ||
} |
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