Merge branch 'main' into feat/organized-content
This commit is contained in:
commit
d7257c7223
|
@ -50,24 +50,35 @@ const menu: NavLink[] = [
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "Resources",
|
name: "Resources",
|
||||||
route: "/resources",
|
route: "/resources/services",
|
||||||
|
submenu: [
|
||||||
|
{
|
||||||
|
name: "Services",
|
||||||
|
route: "/resources/services",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: "Tech Talks",
|
||||||
|
route: "/resources/tech-talks",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: "CS Club Wiki",
|
||||||
|
route: "https://wiki.csclub.uwaterloo.ca/",
|
||||||
|
},
|
||||||
|
],
|
||||||
},
|
},
|
||||||
];
|
];
|
||||||
|
|
||||||
function NavItem(props: NavLink) {
|
function NavItem(props: NavLink) {
|
||||||
const router = useRouter();
|
const router = useRouter();
|
||||||
|
const externalLink =
|
||||||
|
props.route.includes("http://") || props.route.includes("https://");
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<Link href={props.route}>
|
{externalLink ? (
|
||||||
<a
|
<a
|
||||||
title={props.name}
|
href={props.route}
|
||||||
className={
|
target="_blank"
|
||||||
router.pathname === props.route ||
|
rel="noopener noreferrer"
|
||||||
((props.submenu?.length ?? 0) > 0 &&
|
|
||||||
router.pathname.startsWith(props.route))
|
|
||||||
? styles.currentPage
|
|
||||||
: ""
|
|
||||||
}
|
|
||||||
onClick={() => {
|
onClick={() => {
|
||||||
if (document.activeElement instanceof HTMLElement) {
|
if (document.activeElement instanceof HTMLElement) {
|
||||||
document.activeElement.blur();
|
document.activeElement.blur();
|
||||||
|
@ -76,7 +87,27 @@ function NavItem(props: NavLink) {
|
||||||
>
|
>
|
||||||
{props.name}
|
{props.name}
|
||||||
</a>
|
</a>
|
||||||
</Link>
|
) : (
|
||||||
|
<Link href={props.route}>
|
||||||
|
<a
|
||||||
|
title={props.name}
|
||||||
|
className={
|
||||||
|
router.pathname === props.route ||
|
||||||
|
((props.submenu?.length ?? 0) > 0 &&
|
||||||
|
router.pathname.startsWith(props.route))
|
||||||
|
? styles.currentPage
|
||||||
|
: ""
|
||||||
|
}
|
||||||
|
onClick={() => {
|
||||||
|
if (document.activeElement instanceof HTMLElement) {
|
||||||
|
document.activeElement.blur();
|
||||||
|
}
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
{props.name}
|
||||||
|
</a>
|
||||||
|
</Link>
|
||||||
|
)}
|
||||||
{(props.submenu?.length ?? 0) > 0 ? (
|
{(props.submenu?.length ?? 0) > 0 ? (
|
||||||
<ul className={styles.dropdown}>
|
<ul className={styles.dropdown}>
|
||||||
{props.submenu?.map((item) => {
|
{props.submenu?.map((item) => {
|
||||||
|
|
|
@ -1 +0,0 @@
|
||||||
# Resources page
|
|
|
@ -0,0 +1 @@
|
||||||
|
# Services Page
|
|
@ -0,0 +1 @@
|
||||||
|
# Tech Talks Page
|
Loading…
Reference in New Issue